0
Multiple input
60% 20:06 Chatbot v1.0 CODE PROBLEM RESULT Write a program that asks the user for an input and displays it on the screen. You'll continue working on this code after the next lesson. Task Complete the code to ask the user for input, store it in the name variable, and display it on the screen. Input Example name = "Tom" Tom name = "Bob" Expected Output=Bob
11 Respuestas
+ 7
The reason you are getting one test case correct is because you are 'hard coding' (assigning) the name to the variable. You need to use the input() statement. There is no need for multiple inputs, Sololearn is just doing multiple tests on your code to be sure it works correctly.
All you need to do for this practice question is take input, assign it to a variable, and then print it.
Your code should look similar to this but this is incomplete, so fill in the blanks:
# Ask the user for input and store it in a variable
name =
# Display the user input on the screen
print (name)
More info on input() function:
https://www.geeksforgeeks.org/taking-input-in-JUMP_LINK__&&__python__&&__JUMP_LINK/
+ 5
Biggest hint here is don't over think it. Take a string as input and store it, print it to the screen. There is no need to think about multiple inputs, the test cases are delivered one at a time running your code from scratch each time.
Also never put any arguments inside the input function in challenges. It is correct code but causes challenges to fail because it considers it an 'output'.
+ 4
Tinishu very important keywords in the task i would look at.
asks = input
displays = print
+ 3
Ok do you know how to get user input in Python?
+ 2
Can you please share the code you've written?
+ 2
Use code playground, save your code and send the URL here
You can insert your code using the plus "+" sign next to the send button
+ 1
We can't code your projects. Code yourself, then ask if you had bugs...
+ 1
I tried several time and I got case #1 correct but Unable to do the other two. 🇮🇱 Radin Masiha 🇮🇱 if incase you know it I just need some hints. Not must for you to do it for me all. Thanks
0
Yeah I know it.. Here the problem is each case need to be executed differently and incase you do it once the output will be in first box only.( it will be the Answer of case 1)
0
Ask the user to input name
name = input('Tom')
# Display the user input on the screen