can someone please tell me what the error is? https://code.sololearn.com/cmydmr6VbQon/?ref=app | SoloLearn: Learn to code for FREE!

+3

can someone please tell me what the error is? https://code.sololearn.com/cmydmr6VbQon/?ref=app

8/10/2020 11:25:35 AM

иван

9 Answers

New Answer

+4

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.

+5

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.

+4

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)

+3

I am Russian and write through a translator, I do not fully understand what you mean by the word "swim" and "firat"

+3

"swim" is the mod who answered your post. "firat" is a common spelling mistake (for me). It should be "first"

+2

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

+2

but I wrote input (x),but not input(x). Can you explain in more detail otherwise I'm confused please?

+2

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?

+1

https://code.sololearn.com/cmydmr6VbQon/?ref=app