+ 1
I don't understand the output of the following code. Anyone who can help me with it?
num = 7 if num > 3: print("3") if num < 5: print("5") if num == 7: print("7")
6 Antworten
+ 2
Also, don't use a single space for indents. It can get real confusing. Use tab or at least 2 spaces
+ 2
Ooohk so we don't go to look for it until previous if statement is true... Thank you for ur help
+ 1
3
Cause those if statements are inside of eachother. Indentation matters
+ 1
Because you indented the other if statements inside of eachother. 7 will only print if the number provided is greater than 3 and less than 5. When the number is 7, that will never happen.
0
I used a single space in the code (for identation), the output i get is 3 but why cannot it be 7
- 1
Bitta misol bor edi korip berasizma