Skip to content
39 changes: 39 additions & 0 deletions students/KyleCreek/Assignment02/FibonacciSeries.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#---------------------------------------- #
# Title: FibonacciSeries.py
# Change Log: KCreek, 1/15/2018, Rev New
# KCreek, 1/15/2019, Created File
# KCreek, 1/17/2018, Added Comments and DocString
#---------------------------------------- #

def fibonacci(n):

"""
Function Used to print the 'nth' value of the fibonacci series
as provided by the user.
:param n: Describes the nth value of the Fibonacci Series.
:return: Returns the 'nth' value of the Fibonacci
Series.
"""

# Case Statements to handle the first two values of the Fibonacci Series

if n == 1:
return 0
elif n == 2:
return 1

# Case Statement to handle recursive functions after the first two values of the
# Fibonacci Series

else:
while n > 2:
return fibonacci(n - 2) + fibonacci(n - 1)


test = fibonacci(15)
print(test)



test = fibonacci(10)
print(test)
85 changes: 85 additions & 0 deletions students/KyleCreek/Assignment02/FizzBuzz.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
#---------------------------------------- #
# Title: FizzBuzz.py
# Change Log: KCreek, 1/15/2018, Rev New
# KCreek, 1/15/2019, Created File
# KCreek, 1/17/2019, Added Comments and DocString
# KCreek, 1/18/2019, Added Second Fizz Buzz Function
#---------------------------------------- #

def FizzBuzz():

"""
A Function Written to print numbers 1-100 Inclusive.
For Multiples of 3, 'Fizz' is printed in lieu of number
For Multiples of 5, 'Buzz' is printed in lieu of number
For Multiples of 15, 'FizzBuzz" is printed in lieu of number.
:return: No Values are returned by the Function

"""
# Create Counting Flag to for 'while' loop.
# Note: performing a 'for' loop from range(1:100) was also
# Considered, but I got this working and didn't have time to write
# an additional function.

count = 0
while count < 100:

# Case Statement to handle values divisible by both 3 & 5
if count % 3 == 0 and count % 5 == 0:
print('FizzBuzz')
count +=1

# Case Statement to handle values divisible by 3 ONLY
elif count % 3 == 0:
print('Fizz')
count += 1

# Case statement to handle values divisible by 5 ONLY
elif count % 5 == 0:
print('Buzz')
count += 1

# Case statement where values are neither divisible by 3, 5, or
# both 3 & 5.
else:
print(count)
count += 1

# Call Fizzbuzz function
FizzBuzz()


def FizzBuzz2():
"""
A Second Function Written to print numbers 1-100 Inclusive.
For Multiples of 3, 'Fizz' is printed in lieu of number
For Multiples of 5, 'Buzz' is printed in lieu of number
For Multiples of 15, 'FizzBuzz" is printed in lieu of number.
:return: No Values are returned by the Function

"""
# 'for' loop to perform an action for numbers between range
# of 0 - 100
for number in range(100):

# Case Statement to handle values divisible by both 3 and 5
if number % 3 == 0 and number % 5 == 0:
print(number, "FizzBuzz")

# Case Statement to handle values divisible by 3 only
elif number % 3 == 0:
print(number, "Fizz")

# Case Statement to Handle values divisible by 5 only
elif number % 5 == 0:
print(number, "Buzz")

# Case statement to handle values that are neither divisible by 3, 5,
# or 3 & 5
else:
print(number)


# Call the FizzBuzz Function.
FizzBuzz2()

120 changes: 120 additions & 0 deletions students/KyleCreek/Assignment02/GridPrinter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
#---------------------------------------- #
# Title: GridPrinter.py *In Work*
# Change Log: KCreek, 1/15/2018, Rev New
# KCreek, 1/15/2019, Created File
# KCreek, 1/17/2019, Added Comments and DocString
#---------------------------------------- #



def gridPrint1():

"""
Function that Prints a Grid to the Screen .
This is written to meet the first portion of requirements
for assignment02.

"""

# Print each part of grid line by line.

print('+', '-'*4, '+', '-'*4, '+')
print('|', ' '*4, '|', ' '*4, '|')
print('|', ' '*4, '|', ' '*4, '|')
print('|', ' '*4, '|', ' '*4, '|')
print('|', ' '*4, '|', ' '*4, '|')
print('+', '-'*4, '+', '-'*4, '+')
print('|', ' '*4, '|', ' '*4, '|')
print('|', ' '*4, '|', ' '*4, '|')
print('|', ' '*4, '|', ' '*4, '|')
print('|', ' '*4, '|', ' '*4, '|')
print('+', '-'*4, '+', '-'*4, '+')

print("Presenting: GridPrint1: ")
gridPrint1()

# Part2 of GridPrinter Assignment

def gridPrint2(n):

"""
Prints a Grid sized according to a user provided argument.
This is written to meet the second portion of requirements
for assignment02.

:param n: User Provided Argument to determine Scale for Grid Size
:return: Prints Grid to user, no return value provided
"""

# Define the header and spacer sections to be printed out.
# The space is set by the scale provided by the user.

line1 = '+' + '-'*2*n + '+' + '-'*2*n + '+'
line2 = '|' + ' '*2*n + '|' + ' '*2*n + '|'

# Prints the header to the screen.
print(line1)


# 'While' loop to print the portion of the grid between the header and footer.

i = 0
while i < n:
print(line2)
i +=1

print(line1)
i = 0
while i < n:
print(line2)
i += 1

# Print the footer of the grid, which matches the header
print(line1)


# Call the second grid printer function.
print("Presenting GridPrint2: ")
gridPrint2(10)


# Part 3 of GridPrinter Assignment

def gridPrint3(columns,rows):

"""
Prints a Grid with based on the columns and rows provided by the user.
THis is meant to achieve the third portion of assignment02.

:param columns: Number of Columns desired by user
:param rows: Number or Rows desired by user
:return: Prints a grid to the user based on their inputs"""

# Assign Variables to establish header and spacing lines based on the
# user inputs.

columnHeader = '+ - - - - ' * columns + '+'
rowSpacer = ('| ' * columns + '|')

# While loop to print each row and spacer to the screen. Loop ends when
# The desired amount of rows have been printed to the screen to create a
# body

rowCounter = 0
while rowCounter < rows:
print(columnHeader)
i = 0
while i < 3:
print(rowSpacer)
i += 1
rowCounter += 1

# Print the column header to create a footer by the grid.
print(columnHeader)


# Call the third grid printer function for a variety of rows and columns.
print("Presenting 2 different GridPrint3 Functions: ")
#gridPrint3(3, 3)
gridPrint3(2, 5)
gridPrint3(8, 4)
Loading