Skip to content

Russell large #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 75 additions & 0 deletions git_log/setup.txt
Original file line number Diff line number Diff line change
@@ -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 <file>..." 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://[email protected]':
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>






1 change: 1 addition & 0 deletions students/RussLarge-A01/RLargeA01.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is the folder I will use for assignment 01
1 change: 1 addition & 0 deletions students/RussLarge-A01/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
print("This is my test file")
1 change: 1 addition & 0 deletions students/RussellLarge/RussLarge-A01/RLargeA01.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is the folder I will use for assignment 01
35 changes: 35 additions & 0 deletions students/RussellLarge/RussLarge-A01/break_me.py
Original file line number Diff line number Diff line change
@@ -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()
18 changes: 18 additions & 0 deletions students/RussellLarge/RussLarge-A01/front_back.py
Original file line number Diff line number Diff line change
@@ -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]
13 changes: 13 additions & 0 deletions students/RussellLarge/RussLarge-A01/not_string.py
Original file line number Diff line number Diff line change
@@ -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
12 changes: 12 additions & 0 deletions students/RussellLarge/RussLarge-A01/parrot_trouble.py
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions students/RussellLarge/RussLarge-A01/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
print("This is my test file")
26 changes: 26 additions & 0 deletions students/RussellLarge/RussLarge-A02/Even_nums.py
Original file line number Diff line number Diff line change
@@ -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


33 changes: 33 additions & 0 deletions students/RussellLarge/RussLarge-A02/Fizz_Buzz.py
Original file line number Diff line number Diff line change
@@ -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

78 changes: 78 additions & 0 deletions students/RussellLarge/RussLarge-A02/GridPrinter.py
Original file line number Diff line number Diff line change
@@ -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)
80 changes: 80 additions & 0 deletions students/RussellLarge/RussLarge-A02/series.py
Original file line number Diff line number Diff line change
@@ -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")