Single Choice Not Set

QWhich of the following will provide an ! character as alternative separator for the print function?

ID: #3398 Python Basic MCQ 1,449 views
Question Info
#3398Q ID
Not SetDifficulty
Python Basic MCQTopic

Choose the Best Option

Click any option to instantly check if you're correct.

  • A sep is !
  • B separate = !
  • C sep >> '!'
  • D sep = '!'
Correct Answer

Explanation

The print() function provides the sep parameter to specify the separator between multiple values. By default, the separator is a single space, but it can be changed to any character or string.

Example:

print("Apple", "Banana", "Orange", sep="!")

Output:

Apple!Banana!Orange

In this example, the values are separated by the ! character because sep="!" is specified.

The other options are incorrect because they do not use the correct Python syntax for assigning a value to the sep parameter.

Therefore, the correct answer is Option D) sep = '!'.

Share This Question

Challenge a friend or share with your study group.