can someone please tell me what the error is? https://code.sololearn.com/cmydmr6VbQon/?ref=app | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

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

10th Aug 2020, 11:25 AM
иван
иван - avatar
8 Answers
+ 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.
10th Aug 2020, 11:54 AM
Slick
Slick - avatar
+ 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)
10th Aug 2020, 12:09 PM
Slick
Slick - avatar
+ 3
I am Russian and write through a translator, I do not fully understand what you mean by the word "swim" and "firat"
10th Aug 2020, 12:14 PM
иван
иван - avatar
+ 3
"swim" is the mod who answered your post. "firat" is a common spelling mistake (for me). It should be "first"
10th Aug 2020, 12:18 PM
Slick
Slick - avatar
+ 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
10th Aug 2020, 11:31 AM
CutieRei
CutieRei - avatar
+ 2
but I wrote input (x),but not input(x). Can you explain in more detail otherwise I'm confused please?
10th Aug 2020, 11:41 AM
иван
иван - avatar
+ 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?
10th Aug 2020, 12:06 PM
иван
иван - avatar
10th Aug 2020, 11:25 AM
иван
иван - avatar