Skip to content
Merged
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
1 change: 1 addition & 0 deletions intro_comp_sci/3000.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[0, 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584]
Binary file not shown.
13 changes: 3 additions & 10 deletions intro_comp_sci/simple_fibonacci.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,15 @@
"""

from simple_fibonacci_functions import (
select_fib_type, write_information_out, continue_fibonacci
select_fib_type, write_information_out, continue_fibonacci, set_input
)

def main():
continue_fib = True
while continue_fib:
invalid = True

while invalid:
try:
user_input = int(input("What value would you like to go to? "))
invalid = False
except ValueError:
print("Invalid input")

user_input = set_input()

selected_return = input("What type of fib would you like? 1. Get xth fib value, 2. Get all first x fib values, 3. All fibs up to x value ")

current_return = select_fib_type(selected_return, user_input)
Expand All @@ -35,7 +29,6 @@ def main():
if __name__ == "__main__":
main()


# Add UI Component, add memoization
# Add ability to add multiple rows of values (like calling get_first_fibs in for loop)

Expand Down
12 changes: 11 additions & 1 deletion intro_comp_sci/simple_fibonacci_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,14 @@ def continue_fibonacci() -> bool:
if continue_string == "n":
return False
else:
return True
return True

def set_input() -> int:
invalid = True
while invalid:
try:
user_input = int(input("What value would you like to go to? "))
invalid = False
except ValueError:
print("Invalid input")
return user_input