Kidding, it's Fibonacci in Python

Member

adelia_boyer

by adelia_boyer , in category: Python , 2 months ago

Kidding, it's Fibonacci in Python


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
print("Is this a fib?")
discard = input("Decide \n")
print("Kidding, it's Fibonacci.")
intToFib = input("Enter an integer \n")
try:
  newInt = int(intToFib)
  except ValueError:
  	print("Not cool, it wasn't an integer. No Fibonacci for you")
  else:
  	if (newInt < 1):
  	  print("Not cool, it wasn't a positive integer. No Fibonacci for you")
    else:
	  print("The Fibonacci of ", newInt," is ", fibonacci(newInt))


Facebook Twitter LinkedIn Telegram Whatsapp Pocket

no answers