A PHP Error was encountered

Severity: 8192

Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated

Filename: libraries/Filtered_db.php

Line Number: 23

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

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

0

Accept any three string from one input() call

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

Expected Output

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

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Hint:

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

Solution:

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

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now