+ 1
Input function, do not understand the error message
Hi I am writing name=input("enter name: ") print("you entered:" +name, " ", sep=" ", end="!") What I expected is that the user is prompted to enter a name, say Sally, then on the consul will appear" you entered:Sally! But instead I get the message 3 times. i.e. you entered:Sally !you entered:Sally !you entered:Sally ! Can anyone tell me why? And why it's repeating 3 times?
7 Answers
+ 7
hi
if i use your code snippet and run in SoloLearn Code Playground i get the result:
enter name: you entered:Sally !
This all in 1 line. Can you post your code in sololearn and share it here? Would be helpful.
Beside of this, you do not need to use the options argument from print() in this case.
Your code:
print("you entered:" +name, " ", sep=" ", end="!")
can be done this way:
print("You entered: " + name + "!")
or just:
print('You entered: ', name, '!')
+ 4
If the output came three times although you expected one, there clearly has to be a mistake somewhere.
If you post your code, we can help you find it!
+ 4
I am sure your code is OK.
+ 3
Ariella, what could have happend is that you run your code in your system and it outputs it correctly. If you run your code again, the console will not be cleared and so you have the output twice. Run it again and you have it 3 times. can you check this?
+ 2
I think it has to do with the ," " part...I would replace the , with a + then it should work.
Unfortunately I can't explain this behaviour
+ 2
Hi! I posted my code above...
+ 1
Thanks all. I was writing in another place, not solo playrground. I think it's a local issue and the code was ok, at least that's what I am hoping.