Hello, how do you provide 2 inputs and get the code to print 2 outputs ?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Hello, how do you provide 2 inputs and get the code to print 2 outputs ??

I was asked to ask the user for input , store it in the name variable and to display it on the screen. The example were: Input example: name="Tom" name="Bob" Expected output: Tom Bob

28th Sep 2023, 12:28 AM
Isimbi Fany
5 Answers
+ 4
Isimbi Fany , > please add some more information if your question is related to a sololearn tutorial: > tutorial name, module name, lesson or exercise name.
28th Sep 2023, 10:30 AM
Lothar
Lothar - avatar
+ 4
Isimbi Fany , if your question is about the `introduction to python` tutorial, module 2, practice `chatbot v1.0`: > you may be confused by the samples that are used in the tutorial. > what you should do is: > take *one* input (name) as requested, store it in a variable > output this variable
28th Sep 2023, 10:38 AM
Lothar
Lothar - avatar
+ 2
Isimbi Fany Learn how to take inputs in python and print that. https://www.sololearn.com/post/1159836/?ref=app
28th Sep 2023, 5:55 AM
A͢J
A͢J - avatar
+ 1
I fixed it. # The two names must be unique. name1 = "Tom" name2 = "Bob" # Display on screen print(name1) print(name2)
28th Sep 2023, 1:09 AM
PerroLocoYT
PerroLocoYT - avatar
0
You could try and make an array, store both inputs, and then display them Or you could have the second input add to what the input name already was Example: Input name=“Tim” name=“Rob” Output Tim + Rob
29th Sep 2023, 2:51 PM
Timmothy Rain
Timmothy Rain - avatar