Q. Predict the output of following codes:
| Code | Output | |
|---|---|---|
| (a) | if not 3: print("Tricky \n") print ("Yes") |
Yes >>> |
| (b) | if 3: print ("Tricky again") else: print ("Am I right?") print ("No???") |
Tricky again >>> |
| (c) | if (0): print ("Third time Tricky") print ("Am I right?") |
No output because here if statement tret zero as Boolean False. |
| (d) | if (not 0): print ("Fourth time again \n") print ("No??") |
Fourth time again No?? >>> |
| (e) | if 0: print ("Plz! Not again \n") else: print ("Promise, it's the last time") print ("Thank God!!") |
Promise, it's the last time Thank God!! >>> |
Thank you path walla
ReplyDeletePost a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )