Dec-13-2017, 07:36 PM
(This post was last modified: Dec-13-2017, 07:40 PM by sparkz_alot.)
I need to convert a code for class from an "If/Else, For Loop" into a "While" statement.
This is the code we started with:
This is the code we started with:
n = int(input()) if n == 0: print(0) else: a, b = 0, 1 for i in range(2, n + 1): a, b = b, a + b print(b)This is what I have so far:
n = int(input()) a, b = 0, 1 while a == b: a, b = b, a + b print(b)My code is completely wrong but I'm not sure what to do...