Plz I need help on how to execute this task | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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

10th Jul 2023, 10:13 AM
Phakoth
Phakoth - avatar
10 Answers
+ 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.
10th Jul 2023, 10:16 AM
Michaelol
Michaelol - avatar
+ 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*)
10th Jul 2023, 10:35 AM
Lothar
Lothar - avatar
+ 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...
10th Jul 2023, 11:14 AM
Lothar
Lothar - avatar
+ 1
Lothar Let me try this. If it doesn't work I will massage u directly. Thanks 👍
10th Jul 2023, 11:20 AM
Phakoth
Phakoth - avatar
+ 1
Lothar It work 🤗 I use ur idea and the help option. Thank you 😊🤗 Following straight up✅
10th Jul 2023, 11:40 AM
Phakoth
Phakoth - avatar
+ 1
name = input("Please, tell me your name: ") print(name)
11th Jul 2023, 9:25 PM
Vittorio
Vittorio - avatar
0
Not c++ but python
10th Jul 2023, 10:17 AM
Phakoth
Phakoth - avatar
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.
10th Jul 2023, 10:42 AM
Phakoth
Phakoth - avatar
0
name = "Tom" Print(name)
12th Jul 2023, 3:33 AM
ishwar majhi
ishwar majhi - avatar
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
12th Jul 2023, 5:20 AM
Pythonista