+ 1

Whats wrong with this code?

please help.... why is it showing error? https://code.sololearn.com/c5RDYdBWC1q0/?ref=app

27th Jun 2018, 11:43 AM
Pratik Patil
Pratik Patil - avatar
3 Réponses
+ 1
change your first line x=input(" ") by x=int(input(" ")) as you can add two integer numbers
27th Jun 2018, 11:48 AM
Pulkit Kamboj
Pulkit Kamboj - avatar
+ 1
what should the correct code be?
27th Jun 2018, 11:44 AM
Pratik Patil
Pratik Patil - avatar
+ 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(""))
1st Jul 2018, 9:34 PM
Señor Ostrich