+ 2
Confused 🤔
Num=7 If num>3: Print(“3”) If num <5: Print(“5”) If num ==7: Print(“7”) 3
2 Respostas
+ 2
Those are nested if statements. Since the first if statement already returns true (7 > 3 returns true), it stops checking for the rest of the conditions and executes the instructions assigned to that if statement. If you wanted it to really return 7, then "if num == 7:" must be the first check to be done.
+ 2
Hello Abayo! The problem is that the condition num < 5... The program checks num < 5 and since this is not true it stops there.
It never gets to the line if num == 7.
Check out this code. Instead of num < 5, I did num > 5. Run it. :)
https://code.sololearn.com/cM2o374cSTic/?ref=app