9 AnswersNew Answer
9 AnswersNew Answer
the call is: input() #<--no variables go in here if you want, you can add a prompt: input("Enter a number > ") *Doesnt matter on SoloLearn though If you just collect the input without assigning it, the computer will forget. So: x = input("Enter a number > ") *BUT a problem arises, youre adding x and a number at the end and by default, input returns a string. So you need to change the inputs type. x = int(input("Enter a number > ")) Please go through the tutorial again.
We know we can specify optional information in the input method. So when you pass x to input, it's value is shown to the user. The 0 is coming from that. The input value is not captured then you print(x + 1) which will give 1 so it prints like 01 at sololearn. In interactive mode user will be shown 0 and program waits for user input, say user enters some value 0567 #567 will be ignored since it is not captured and result of addition x+1 will be shown on next line.
As swim stated, when you put the x in input() [you still have input(x)] you will get 0 in your output because the first thing your script does is assign x to 0. Take x out of input(x)
I am Russian and write through a translator, I do not fully understand what you mean by the word "swim" and "firat"
"swim" is the mod who answered your post. "firat" is a common spelling mistake (for me). It should be "first"
indent, you use input() not input () same goes for print. Also its a string, and your adding string to a integers, I'm surprised Sololearn did not raise any Syntax error on that one
but I wrote input (x),but not input(x). Can you explain in more detail otherwise I'm confused please?
Thank you, but how to make the program write the answer without zero? Well, that is, the program always puts the number zero before the answer. Why?
Learn Playing. Play Learning
SoloLearn Inc.4 Embarcadero Center, Suite 1455
Send us a message