0
Actually i am not understanding the "True " and "False" condition by which my code running "already " statements.
command = '' y = 0 while True: command = input('>>').lower() if command == "up": if y: print("already up") else: y = 1 print ("bird is flying") elif command =="down": if not y: print ('already down') else: y = 0 print ("bird is landing") elif command == "help": print("so ,what might be the problem") elif command == "quit": break else: print('aa')
3 Respuestas
+ 5
Please try to post your code with this format:
https://www.sololearn.com/post/75089/?ref=app
0
Like
I command
" Up"
Then again
"Up"
And it was giving already flying
0
If your first input is "up", then in 1sr if, if y : is false because y =0, so else part set y=1,and prints bird is flying..
If you next input = "up", again 1st if, if y: is true, because y=1 now, so prints "already up"...