Python Forum
Code does not complete - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Code does not complete (/thread-17399.html)



Code does not complete - sc0pe - Apr-09-2019

x = int(input("Enter the number of apples: "))
c = input("what do you want to do with the apple?: ")
if x == 1:
    print("got it")
elif x == 2:
    print("got it")
if c == "store it"
    print("apple is stored")
My issue is when i run the code, it completes the final if statement if c == "store it" but only if I enter a maximum of 2. If I enter 3+, it will not complete that last if statement. Can someone guide me in the right direction?

the actual code is much longer but the same idea. I was thinking maybe the code is too long and by the time it reaches that last if statement it forgets what c was equal to?


RE: Code does not complete - Yoriz - Apr-09-2019

if c == "store it" is missing a : from the end.
The result of input value stored in x has no influence over the if c == "store it": statement.
It doesn't matter how long the code is , it will not forget the value of c.