asked 181k views
5 votes
Which is a properly formatted Python print() function example?

a. print("Welcome the", 3, New students!)
b. print("Welcome the", 3 + New students!)
c. print("Welcome the", 3, "New students!")
d. print("Welcome the", 3 + " New students!")

asked
User Amlxv
by
8.7k points

1 Answer

4 votes

Final answer:

The properly formatted Python print() example is c, which correctly uses commas to separate strings and numbers within the print function.

Step-by-step explanation:

The student has asked to identify which example is a properly formatted Python print() function call. The correct answer is c. print("Welcome the", 3, "New students!"). This syntax correctly uses a comma to separate items that being printed. In Python, the print() function can take multiple arguments and print them with a space in between by default. The other options are improperly formatted because they either lack quotes around strings, attempt to concatenate a string with a number directly (which is not allowed), or have some other syntax error.

answered
User BaggersIO
by
7.7k points