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

5th Jan 2024, 6:09 PM
Tinishu
Tinishu - avatar
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/
5th Jan 2024, 9:18 PM
Keith
Keith - avatar
+ 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'.
5th Jan 2024, 9:08 PM
StuartH
StuartH - avatar
+ 4
Tinishu very important keywords in the task i would look at. asks = input displays = print
5th Jan 2024, 9:07 PM
Junior
Junior - avatar
+ 3
Ok do you know how to get user input in Python?
5th Jan 2024, 8:39 PM
🇮🇱 Radin Masiha 🇮🇱
🇮🇱 Radin Masiha 🇮🇱 - avatar
+ 2
Can you please share the code you've written?
5th Jan 2024, 8:43 PM
🇮🇱 Radin Masiha 🇮🇱
🇮🇱 Radin Masiha 🇮🇱 - avatar
+ 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
5th Jan 2024, 8:47 PM
🇮🇱 Radin Masiha 🇮🇱
🇮🇱 Radin Masiha 🇮🇱 - avatar
+ 1
We can't code your projects. Code yourself, then ask if you had bugs...
5th Jan 2024, 8:31 PM
🇮🇱 Radin Masiha 🇮🇱
🇮🇱 Radin Masiha 🇮🇱 - avatar
+ 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
5th Jan 2024, 8:35 PM
Tinishu
Tinishu - avatar
+ 1
Thank you Keith and StuartH . Your replies has being helpful to me. I really appreciate
6th Jan 2024, 9:25 AM
Tinishu
Tinishu - avatar
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)
5th Jan 2024, 8:41 PM
Tinishu
Tinishu - avatar
0
Ask the user to input name name = input('Tom') # Display the user input on the screen
5th Jan 2024, 8:45 PM
Tinishu
Tinishu - avatar