diff --git a/git_log/setup.txt b/git_log/setup.txt new file mode 100644 index 0000000..12bb750 --- /dev/null +++ b/git_log/setup.txt @@ -0,0 +1,75 @@ +Your branch is up to date with 'origin/master'. + +nothing to commit, working tree clean +PS C:\Python210\Python210-Winter19> git branch RussellLarge +PS C:\Python210\Python210-Winter19> git checkout RussellLarge +Switched to branch 'RussellLarge' +PS C:\Python210\Python210-Winter19> mkdir RussLarge-A01 + + + Directory: C:\Python210\Python210-Winter19 + + +Mode LastWriteTime Length Name +---- ------------- ------ ---- +d----- 1/15/2019 6:39 PM RussLarge-A01 + + +PS C:\Python210\Python210-Winter19> cd RussLarge-A01 +PS C:\Python210\Python210-Winter19\RussLarge-A01> git add +Nothing specified, nothing added. +Maybe you wanted to say 'git add .'? +PS C:\Python210\Python210-Winter19\RussLarge-A01> git add . +PS C:\Python210\Python210-Winter19\RussLarge-A01> git status +On branch RussellLarge +Changes to be committed: + (use "git reset HEAD ..." to unstage) + + new file: RLargeA01.txt + +PS C:\Python210\Python210-Winter19\RussLarge-A01> git commit -m "Started Branch" +[RussellLarge c7db2a5] Started Branch + 1 file changed, 1 insertion(+) + create mode 100644 RussLarge-A01/RLargeA01.txt +PS C:\Python210\Python210-Winter19\RussLarge-A01> git push --set-upstream origin russlarge256 +error: src refspec russlarge256 does not match any. +error: failed to push some refs to 'https://github.com/rootrUW/Python210-Winter19.git' +PS C:\Python210\Python210-Winter19\RussLarge-A01> git push --set-upstream origin russlarge256 +error: src refspec russlarge256 does not match any. +error: failed to push some refs to 'https://github.com/rootrUW/Python210-Winter19.git' +PS C:\Python210\Python210-Winter19\RussLarge-A01> git push --set-upstream origin RussellLarge +Logon failed, use ctrl+c to cancel basic credential prompt. +Username for 'https://github.com': russlarge256 +Password for 'https://russlarge256@github.com': +remote: Invalid username or password. +fatal: Authentication failed for 'https://github.com/rootrUW/Python210-Winter19.git/' +PS C:\Python210\Python210-Winter19\RussLarge-A01> git push --set-upstream origin RussellLarge +Logon failed, use ctrl+c to cancel basic credential prompt. +Username for 'https://github.com': fatal: could not read Username for 'https://github.com': No error +PS C:\Python210\Python210-Winter19\RussLarge-A01> git push --set-upstream origin russlarge256 +error: src refspec russlarge256 does not match any. +error: failed to push some refs to 'https://github.com/rootrUW/Python210-Winter19.git' +PS C:\Python210\Python210-Winter19\RussLarge-A01> git push --set-upstream origin RussellLarge +Logon failed, use ctrl+c to cancel basic credential prompt. +Username for 'https://github.com': fatal: could not read Username for 'https://github.com': No error +PS C:\Python210\Python210-Winter19\RussLarge-A01> git push --set-upstream origin RussellLarge +Logon failed, use ctrl+c to cancel basic credential prompt. +Username for 'https://github.com': fatal: could not read Username for 'https://github.com': No error +PS C:\Python210\Python210-Winter19\RussLarge-A01> git push --set-upstream origin RussellLarge +Enumerating objects: 5, done. +Counting objects: 100% (5/5), done. +Delta compression using up to 8 threads +Compressing objects: 100% (2/2), done. +Writing objects: 100% (4/4), 369 bytes | 123.00 KiB/s, done. +Total 4 (delta 1), reused 1 (delta 0) +remote: Resolving deltas: 100% (1/1), completed with 1 local object. +To https://github.com/rootrUW/Python210-Winter19.git + 7e557dc..c7db2a5 RussellLarge -> RussellLarge +Branch 'RussellLarge' set up to track remote branch 'RussellLarge' from 'origin'. +PS C:\Python210\Python210-Winter19\RussLarge-A01> + + + + + + diff --git a/students/RussLarge-A01/RLargeA01.txt b/students/RussLarge-A01/RLargeA01.txt new file mode 100644 index 0000000..69a022c --- /dev/null +++ b/students/RussLarge-A01/RLargeA01.txt @@ -0,0 +1 @@ +This is the folder I will use for assignment 01 \ No newline at end of file diff --git a/students/RussLarge-A01/test.py b/students/RussLarge-A01/test.py new file mode 100644 index 0000000..9743ac1 --- /dev/null +++ b/students/RussLarge-A01/test.py @@ -0,0 +1 @@ +print("This is my test file") \ No newline at end of file diff --git a/students/RussellLarge/RussLarge-A01/RLargeA01.txt b/students/RussellLarge/RussLarge-A01/RLargeA01.txt new file mode 100644 index 0000000..69a022c --- /dev/null +++ b/students/RussellLarge/RussLarge-A01/RLargeA01.txt @@ -0,0 +1 @@ +This is the folder I will use for assignment 01 \ No newline at end of file diff --git a/students/RussellLarge/RussLarge-A01/break_me.py b/students/RussellLarge/RussLarge-A01/break_me.py new file mode 100644 index 0000000..e92231b --- /dev/null +++ b/students/RussellLarge/RussLarge-A01/break_me.py @@ -0,0 +1,35 @@ +# -------------------------- # +# Title: Task 1: Explore Errors +# Changelog (who, when, what): +# Russell Large, 1-17-19, created +# -------------------------- # + +def NameError(): + try: + NameError() + except: + print("local/global name not found. applies only to unqualified names.\n") + +def TypeError(): + try: + TypeError() + except: + print("operation/function applied to an object of inappropriate type.\n") + +def SyntaxError(): + try: + SyntaxError() + except: + print("parser encountered a syntax error.\n") + +def AttributeError(): + try: + AttributeError() + except: + print("attribute reference failed.\n") + + +NameError() +TypeError() +SyntaxError() +AttributeError() \ No newline at end of file diff --git a/students/RussellLarge/RussLarge-A01/front_back.py b/students/RussellLarge/RussLarge-A01/front_back.py new file mode 100644 index 0000000..aff2ebf --- /dev/null +++ b/students/RussellLarge/RussLarge-A01/front_back.py @@ -0,0 +1,18 @@ +# -------------------------- # +# Title: Warmup-1 > front_back +# Changelog: +# Russell Large, 1-16-19 +# -------------------------- # + + +def front_back(str): + # set up code for values less than or equal to 1 + if len(str) <= 1: + return str + + # set up variables + v1 = len(str)-1 + v2 = str[1:-1] + + # return value + return str[v1] + v2 + str[0] \ No newline at end of file diff --git a/students/RussellLarge/RussLarge-A01/not_string.py b/students/RussellLarge/RussLarge-A01/not_string.py new file mode 100644 index 0000000..214fa76 --- /dev/null +++ b/students/RussellLarge/RussLarge-A01/not_string.py @@ -0,0 +1,13 @@ +# -------------------------- # +# Title: Warmup-1 > not_string +# Changelog: +# Russell Large, 1-16-19 +# -------------------------- # + + +def not_string(str): + if str[0:3] == 'not': + return str + else: + add = "not" + return add + ' ' + str diff --git a/students/RussellLarge/RussLarge-A01/parrot_trouble.py b/students/RussellLarge/RussLarge-A01/parrot_trouble.py new file mode 100644 index 0000000..27be0fb --- /dev/null +++ b/students/RussellLarge/RussLarge-A01/parrot_trouble.py @@ -0,0 +1,12 @@ +# -------------------------- # +# Title: Warmup-1 > parrot_trouble +# Changelog: +# Russell Large, 1-16-19 +# -------------------------- # + + +def parrot_trouble(talking, hour): + if talking and (hour < 7 or hour > 20): + return True + else: + return False diff --git a/students/RussellLarge/RussLarge-A01/test.py b/students/RussellLarge/RussLarge-A01/test.py new file mode 100644 index 0000000..9743ac1 --- /dev/null +++ b/students/RussellLarge/RussLarge-A01/test.py @@ -0,0 +1 @@ +print("This is my test file") \ No newline at end of file diff --git a/students/RussellLarge/RussLarge-A02/Even_nums.py b/students/RussellLarge/RussLarge-A02/Even_nums.py new file mode 100644 index 0000000..0773491 --- /dev/null +++ b/students/RussellLarge/RussLarge-A02/Even_nums.py @@ -0,0 +1,26 @@ +# -------------------------- # +# Title: CodingBat: Count Evens +# Changelog: +# Russell Large, 1-23-19, created code +# -------------------------- # + +def count_evens(nums): + '''Return the number of even ints in the given array. Note: the % "mod" operator computes the remainder, e.g. 5 % 2 is 1. + Examples: + count_evens([2, 1, 2, 3, 4]) → 3 + count_evens([2, 2, 0]) → 3 + count_evens([1, 3, 5]) → 0 + ''' + + count = 0 + for n in nums: + count -= n % 2 - 1 + return count + +# ----------- Test Code -------------- # + +print(count_evens([2, 1, 2, 3, 4])) # should equal 3 +print(count_evens([2, 2, 0])) # should equal 3 +print(count_evens([1, 3, 5])) # should equal 0 + + diff --git a/students/RussellLarge/RussLarge-A02/Fizz_Buzz.py b/students/RussellLarge/RussLarge-A02/Fizz_Buzz.py new file mode 100644 index 0000000..0cbb309 --- /dev/null +++ b/students/RussellLarge/RussLarge-A02/Fizz_Buzz.py @@ -0,0 +1,33 @@ +#---------------------------------------------------# +# Title: FizzBuzz +# Dev: RLarge +# Date: 1/22/2019 +# ChangeLog: (Who, When, What) +# Russell Large, 1/22/2019, Created script +#---------------------------------------------------# + +# ------------------ Instructions ----------------- # + +# Write a program that iterates the numbers from 1 to 100 inclusive. +# But for multiples of three print "Fizz" instead of the number. +# But for multiples of five print "Fizz" instead of the number. +# For numbers which are multiples of both three and five print “FizzBuzz” instead. + + +# ------------------ Data ------------------------- # + +equation = list(range(1, 101)) + +# ------------------ Processing ------------------- # + +for x in equation: + if x % 3 == 0 and x % 5 == 0: # Multiplicity of 3 & 4 + print("FizzBuzz") + elif x % 3 == 0: # Multiplicity of 3 + print("Fizz") + #print("Fizz") + elif x % 5 == 0: # Multiplicity of 4 + print("Buzz") + else: + print(x) # All other values + diff --git a/students/RussellLarge/RussLarge-A02/GridPrinter.py b/students/RussellLarge/RussLarge-A02/GridPrinter.py new file mode 100644 index 0000000..e33c0a9 --- /dev/null +++ b/students/RussellLarge/RussLarge-A02/GridPrinter.py @@ -0,0 +1,78 @@ +# -------------------------- # +# Title: GridPrinter +# Changelog: +# Russell Large, 1-22-19 +# -------------------------- # + +# ----------- Layout -------- # +# Data = parameters used +# Phase 1 (non-function, static script) +# Phase 2 (function, one parameter) +# Phase 3 (function, two parameters) + + +#-------------- Phase 1 ----------- # + + +# ------------ Data ----------# + +PlusSign = '+ ' +MinusSign = ' - ' +ColumnSign = '| ' +space = ' ' +MiddleColumn = (ColumnSign + space*12 + ColumnSign + space*12 + ColumnSign) + + +Line1Type = (PlusSign + (MinusSign*4) + PlusSign + (MinusSign*4) + PlusSign) # Long +Line2Type = (((ColumnSign + space*12 + ColumnSign + space*12 + ColumnSign) + '\n')*4) # Long +Line3Type = (MiddleColumn + '\n')*3 + MiddleColumn + +print(Line1Type) +print(Line2Type, end='') # lat +print(Line1Type) +print(Line2Type, end='') # lat +print(Line1Type) + +#-------------- Phase 2 ----------- # + +def GridPrinter(x): + + PlusSign = '+ ' + MinusSign = ' - ' + ColumnSign = '| ' + space = ' ' + MiddleColumn = (ColumnSign + space * 12 + ColumnSign + space * 12 + ColumnSign) + + Line1Type = (PlusSign + (MinusSign * 4*x) + PlusSign + (MinusSign * 4*x) + PlusSign) # Long + Line2Type = (((ColumnSign + space * 12*x + ColumnSign + space * 12*x + ColumnSign) + '\n') * 4) # Long + Line3Type = (MiddleColumn + '\n') * 3 + MiddleColumn + + print(Line1Type) + print(Line2Type*x, end='') # lat + print(Line1Type) + print(Line2Type*x, end='') # lat + print(Line1Type) + + +GridPrinter(1) + +# ------------ Phase 3 ------------- # + +def GridPrinter2(x,y): + + PlusSign = '+ ' + MinusSign = ' - ' + ColumnSign = '| ' + space = ' ' + MiddleColumn = (ColumnSign + space * 12 + ColumnSign + space * 12 + ColumnSign) + + Line1Type = (PlusSign + (MinusSign * 4*x) + PlusSign + (MinusSign * 4*x) + PlusSign) # Long + Line2Type = (((ColumnSign + space * 12*x + ColumnSign + space * 12*x + ColumnSign) + '\n') * 4) # Long + + print(Line1Type) + print(Line2Type*y, end='') # lat + print(Line1Type) + print(Line2Type*y, end='') # lat + print(Line1Type) + +GridPrinter2(1,1) \ No newline at end of file diff --git a/students/RussellLarge/RussLarge-A02/series.py b/students/RussellLarge/RussLarge-A02/series.py new file mode 100644 index 0000000..bc51016 --- /dev/null +++ b/students/RussellLarge/RussLarge-A02/series.py @@ -0,0 +1,80 @@ +# ------------------------------------------------------------------------- # +# Title: Fibonacci series +# Changelog: +# pythoncert template used to start +# Russell Large, 1-22-19, added code for each function to complete exercise +# ------------------------------------------------------------------------- # + +# !/usr/bin/env python3 + +""" +Series Assessment Module +""" + + +def fibonacci(n): + """ compute the nth Fibonacci number """ + if n == 0: + return 0 + elif n == 1: + return 1 + else: + return fibonacci(n - 2) + fibonacci(n - 1) + pass + +def lucas(n): + """ compute the nth Lucas number """ + if n < 0: + return None + elif n == 0: + return 2 + elif n == 1: + return 1 + else: + return lucas(n - 2) + lucas(n - 1) + pass + +def sum_series(n, n0=0, n1=1): + """ + compute the nth value of a summation series. + + :param n0=0: value of zeroth element in the series + :param n1=1: value of first element in the series + + This function should generalize the fibonacci() and the lucas(), + so that this function works for any first two numbers for a sum series. + Once generalized that way, sum_series(n, 0, 1) should be equivalent to fibonacci(n). + And sum_series(n, 2, 1) should be equivalent to lucas(n). + """ + if n == 0: + return n0 + elif n == 1: + return n1 + else: + return sum_series(n-1, n0, n1) + sum_series(n - 2, n0, n1) + pass + + +if __name__ == "__main__": + # run some tests + assert fibonacci(0) == 0 + assert fibonacci(1) == 1 + assert fibonacci(2) == 1 + assert fibonacci(3) == 2 + assert fibonacci(4) == 3 + assert fibonacci(5) == 5 + assert fibonacci(6) == 8 + assert fibonacci(7) == 13 + + assert lucas(0) == 2 + assert lucas(1) == 1 + + assert lucas(4) == 7 + + # test if sum_series matched fibonacci + assert sum_series(5) == fibonacci(5) + + # test if sum_series matched lucas + assert sum_series(5, 2, 1) == lucas(5) + + print("tests passed")