why is 7 incorrect? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

why is 7 incorrect?

in this code num=7 so if num==7 why would the answer 7 not also be correct? 7 is = to 7. 7 is also greater than 3. so it would seem that he answer could be 3 or 7

8th May 2018, 1:27 PM
Rahsaan Johnson
Rahsaan Johnson - avatar
11 Answers
+ 2
num=7 if num>3: print("3") if num<5: print("5") if num ==7: print("7") #Outputs "3\n7", seems to like an incorrect answer.
8th May 2018, 2:00 PM
Timon Paßlick
+ 1
ok i though so too. nice to know im not crazy.
8th May 2018, 2:28 PM
Rahsaan Johnson
Rahsaan Johnson - avatar
+ 1
You can report it for having an incorrect answer if you want to.
8th May 2018, 2:29 PM
Timon Paßlick
+ 1
Click challenge -> view correct answers -> top right
9th May 2018, 3:14 PM
Timon Paßlick
+ 1
got it thanks
9th May 2018, 3:22 PM
Rahsaan Johnson
Rahsaan Johnson - avatar
0
Rahsaan Johnson can you, please post the whole code so that we may be able to help?
8th May 2018, 1:33 PM
Ulisses Cruz
Ulisses Cruz - avatar
0
what is the output of this code? num=7 if num>3 print("3") if num<5 print("5") if num ==7 print("7") the answers is 3 but couldn't it also be 7
8th May 2018, 1:56 PM
Rahsaan Johnson
Rahsaan Johnson - avatar
0
Timon. I don't understand why the answer could not be 7 as 7 is equal to 7. its also true that 7 is greater than 3 both would be true.
8th May 2018, 2:26 PM
Rahsaan Johnson
Rahsaan Johnson - avatar
0
Yes, it actually printed both. The answer in the challenge seems to be wrong.
8th May 2018, 2:27 PM
Timon Paßlick
0
how?
9th May 2018, 2:58 PM
Rahsaan Johnson
Rahsaan Johnson - avatar
0
Entiendo que 7 es mayor que 3 debería imprimir 3 pero tmbn 7 es igual a 7 y marca error
6th Nov 2019, 5:45 AM
Arland Curi
Arland Curi - avatar