0
Whats wrong with this code
x = input("Enter a number: ") if x > 10 print("Number is greater than 10.")
9 Answers
+ 4
You should convert the input into int
and the if statement are missing ( : )
+ 3
X=int(input("Enter a number:"))
if x>10:
Print("Number is greater than 10.")
+ 2
OP, do you use ChatGPT? Ask the chat bot whatâs wrong, and it can highlight the issues for you, telling you why itâs wrong. It helps if youâve been staring at code too long and canât see the errors anymore hahhah
+ 1
Tips
Try the code in the playground, and check the data type of variable x.
This command tells you the data type (it also covered in the course).
print(type(x))
+ 1
https://sololearn.com/compiler-playground/cZsJ3Fr3BeSV/?ref=app
Use this as a reference. It's a debug of the code written above
+ 1
It's a correct :
x=int(input("Enter a number: "))
if x>10:
Print(x)
print("Number is greater than 10")
0
Discuss section is NOT A QUIZ.
Do you need help with your code?
0
I didnt know
0
x=int(input())
if x>10:
print("Number,You choosed, is greater than 10.")
else:
print("Number,You choosed, is lesser than 10.")