fibonacci sequence python
# This program also assumes the fibonacci sequence starts at 1
# This code will print as many digits as the user wishes
# Instead of printing a specific number in the sequence
def fibonacci(digits):
digit1, digit2 = 1, 1
amount_of_digits = 0
print(str(digit1) + ", " + str(digit2) + ', ', end='')
while amount_of_digits != digits:
digit1, digit2 = digit2, digit1 + digit2
print(str(digit2) + ", ", end='') # we want to print on the same line
amount_of_digits = amount_of_digits + 1
if amount_of_digits == digits:
print('\n')
print('Loop done.')
break
fibonacci(10) # this will print the first 10 digits in the sequence