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
7 odpowiedzi
+ 1
Bacause the if statements are bad indented
+ 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 :)
+ 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.
+ 1
You're welcome! :)
0
Hi Brian Yaguchi
Could you please share the code? I couldn't find anything like Num==7 in the post you linked.
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”)
0
oh thats probably just my fault retyping the code it was from a question from a quiz