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')

15th Sep 2020, 4:37 PM
#challenger mg
#challenger mg - avatar
3 ответов
+ 5
Please try to post your code with this format: https://www.sololearn.com/post/75089/?ref=app
15th Sep 2020, 4:37 PM
The future is now thanks to science
The future is now thanks to science - avatar
0
Like I command " Up" Then again "Up" And it was giving already flying
15th Sep 2020, 4:38 PM
#challenger mg
#challenger mg - avatar
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"...
15th Sep 2020, 4:53 PM
Jayakrishna 🇮🇳