+ 2
Plz I need help on how to execute this task
Complete the code to ask the user for input, store it in the name variable, and display it on the screen. Example given : name = "Tom" to display Tom
10 Réponses
+ 1
For c++, you can store the input into a string (for example string s) and cin s
then you let s be equal to some variable
Then you can out put the variable.
+ 6
Phakoth ,
first step:
> to get a user input (name) we can use the input() function. store the result of the input in a variable. do not use any input prompt.
second step:
> to output the name given from step 1, we can use the print() function.
use the variable from step 1 as an argument in the print() function like print(*argument*)
+ 5
Phakoth ,
taking input is ok.
for output we need print() not Print(), and we also need the *variable name* inside the parentheses of the print() function.
if this does not help, we need some more information where to find the task in the tutorial: chapter, lesson, task description...
+ 1
Lothar
Let me try this.
If it doesn't work I will massage u directly.
Thanks 👍
+ 1
Lothar
It work 🤗
I use ur idea and the help option.
Thank you 😊🤗
Following straight up✅
+ 1
name = input("Please, tell me your name: ")
print(name)
0
Not c++ but python
0
Lothar
Do you like this
Name = input ()
Print ("name")
I have done this single it bring error and I have included it in all three steps for Tom, for Bob and Alice.
I don't mind if you can explain for me.
0
name = "Tom"
Print(name)
0
Lothar the problem is your caps Python is very sensitive to caps
Name = input()
Print is wrong it should be small p
And the name you put inside the parethesis is small n yet you declared a capital letter.
So here is how it should have been written
name = input()
print(name)
No need of parethesis around name in the print function
Hope it helps