0
Whats wrong with this code
x = input("Enter a number: ") if x > 10 print("Number is greater than 10.")
9 Respostas
+ 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.")