[Challenge] What will be displayed if 3 is an input?. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

[Challenge] What will be displayed if 3 is an input?.

a = input("Enter a number:") if a==3: print("hello") else: print("Good game")

2nd Dec 2017, 3:17 AM
Đồng Vũ Minh Phúc
Đồng Vũ Minh Phúc - avatar
7 Answers
+ 6
Oh wait, i realise a is not an integer. Hence the output is "good game". Nice! Make a quiz question out of this!
2nd Dec 2017, 4:03 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 2
@blackcat1111 I forgot to mention, this is a challenge :)
2nd Dec 2017, 3:58 AM
Đồng Vũ Minh Phúc
Đồng Vũ Minh Phúc - avatar
+ 2
@Pegasus Sr mate. Your answer is not correct :)
2nd Dec 2017, 4:02 AM
Đồng Vũ Minh Phúc
Đồng Vũ Minh Phúc - avatar
+ 2
In my opinion, the question is wrong. It never said the user inputted 3, but rather that a *is* 3, an integer. Therefore, the answer is "hello". I understand your point, but I think you should rephrase your question to be more clear. 😉
2nd Dec 2017, 4:22 AM
blackcat1111
blackcat1111 - avatar
+ 2
# Outputs 'Good game'
2nd Dec 2017, 5:21 AM
#RahulVerma
#RahulVerma - avatar
+ 1
Why don't you try it yourself? There's Code Playground for a reason.
2nd Dec 2017, 3:24 AM
blackcat1111
blackcat1111 - avatar
+ 1
It'll print "hello"
2nd Dec 2017, 3:35 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar