no output | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

no output

num=7 if num==3: print("3") if num<5: print("5") if num==7: print("7") Why this code giving no output? please help!

4th Jun 2020, 11:19 AM
Anil Gurjar
Anil Gurjar - avatar
2 Answers
+ 4
First if condition is false so noting below that will be executed. If you want to execute indent your code properly. Hope it will help. Happy coding.
4th Jun 2020, 11:21 AM
ツSampriya😘ツ
ツSampriya😘ツ - avatar
+ 1
....because if statement's are nested inside the first statement...... (if num==3)... if you want to get output use either else if statement or indent if statements properly...
4th Jun 2020, 12:02 PM
Nahoma
Nahoma - avatar