0

Num == 7

What is the reason it didn’t also print a 7? Isn’t Num == 7 a true statement? https://www.sololearn.com/discuss/1197006/?ref=app

23rd Nov 2018, 11:44 PM
Brian Yaguchi
Brian Yaguchi - avatar
7 RĂ©ponses
+ 1
Bacause the if statements are bad indented
24th Nov 2018, 6:29 AM
Etabeta1🇼đŸ‡č
Etabeta1🇼đŸ‡č - avatar
+ 1
No worries, Brian Yaguchi You should be able to edit a post by clicking the three vertical dots on the top right corner. Anyway, for your code, the reason the num==7 condition is not evaluated is that it's nested within the "if num<5" block. So when it sees that num is not less than 5, it doesn't even check the other stuff in the block. If you change the indentation like this, things should work out fine: num = 7 if > 3: print(“3”) if num < 5: print(“5”) if num == 7: print(“7”) Please let me know if you need any further help :)
24th Nov 2018, 6:32 AM
Kishalaya Saha
Kishalaya Saha - avatar
+ 1
i saw the edit function earlier but i couldnt figure out how to delete the link. ill try again. and thank you that makes perfect sense and now what andrea was saying also makes sense to me. thank you to both.
24th Nov 2018, 6:34 AM
Brian Yaguchi
Brian Yaguchi - avatar
+ 1
You're welcome! :)
24th Nov 2018, 6:42 AM
Kishalaya Saha
Kishalaya Saha - avatar
0
Hi Brian Yaguchi Could you please share the code? I couldn't find anything like Num==7 in the post you linked.
24th Nov 2018, 2:44 AM
Kishalaya Saha
Kishalaya Saha - avatar
0
im sorry i didnt even mean to link that post and i coildnt figure out how to delete it. I’m new 🙄. it was the last question in the if statements module: num = 7 if > 3: print(“3”) if num < 5: print(“5”) if num == 7: print(“7”)
24th Nov 2018, 6:23 AM
Brian Yaguchi
Brian Yaguchi - avatar
0
oh thats probably just my fault retyping the code it was from a question from a quiz
24th Nov 2018, 6:31 AM
Brian Yaguchi
Brian Yaguchi - avatar