41.1k views
17 votes
Use input() function to take 4 user inputs as variables and choose at least 2 ways to print out the following statements. You cannot print the statement literally.

User Ariets
by
5.1k points

1 Answer

1 vote

Answer:

statements = tuple(input("Enter four statements separated by comma: ").split(","))

st1, st2, st3, st4 = statements

#print with:

print(f"{st1}, {st2}, {st3}, {st4}")

# or:

print("{}, {}, {}, {}".format(st1, st2, st3, st4))

Step-by-step explanation:

The input function in python is used to prompt for user input. It returns a string. The code above splits the string of the input function and converts it to a tuple, which is unpacked in four variables st1, st2, st3, and st4.

The variables can be printed out as strings directly or by using the "f" keyword or the format function.

User Yinnonsanders
by
5.3k points