I have this python source code:
while True:
answer = input("\nApple or Nokia?")
if answer == 'Apple':
print("Nice, you have Apple!")
if answer == 'Nokia':
print("Nice, you have Nokia!")
else:
print("I do not understand.")
But when I run it and write Apple, the python says:
Apple or Nokia?Apple
Nice, you have Apple!
I do not understand.
Apple or Nokia?
I don't know why python writes "I do not understand."
elif answer == 'Nokia':
if
should be anelif
(else if). Otherwise on an'Apple'
input the firstif
and theelse
from the secondif
will be executed.