+ 1
Whats wrong with this code?
please help.... why is it showing error? https://code.sololearn.com/c5RDYdBWC1q0/?ref=app
3 Réponses
+ 1
change your first line x=input(" ")
by x=int(input(" "))
as you can add two integer numbers
+ 1
what should the correct code be?
+ 1
This should be the code:
x = int(input(""))
print(x)
print(x + 3)
print(x)
The reason it didn't work is because the input could have also been a string. And the computer doesn't process that right, because you might as well write "Hello" as the input. Whenever you want the input to be a number, do: int(input(""))