Home / Programs / Write a python program to take three names as input from a user in the single input() function call.
🚀 Programming Example

Write a python program to take three names as input from a user in the single input() function call.

👁 1,150 Views
💻 Practical Program
📘 Step Learning

Accept any three string from one input() call

📌 Information & Algorithm

Given Input:

Emma Jessa Kelly

Expected Output:

Enter three string Emma Jessa Kelly
Name1: Emma
Name2: Jessa
Name3: Kelly

Hints:

  • Ask the user to enter three names separated by space
  • Split input string on whitespace using the split() function to get three individual names

💻 Program Code

str1, str2, str3 = input("Enter three string").split()
print('Name1:', str1)
print('Name2:', str2)
print('Name3:', str3)
                        

🖥 Program Output

Enter three string Rumman Ansari Hello
Name1: Rumman
Name2: Ansari
Name3: Hello
                            
📚 Learning Subject

Master Programming Through Practical Examples

Improve your coding logic, problem-solving skills and programming confidence by practicing real-world examples with explanations.

🎯 How to learn from this example

First understand the algorithm carefully. Then study the program line-by-line and compare it with the output. Finally, review the explanation section to strengthen your logic and programming understanding.

🔥 Practice suggestion

Rewrite the program without looking at the code. Modify values, conditions or logic and run it again. This helps improve confidence and strengthens coding skills much faster.