If a List L=['Hello', 'World!'] Identify the correct output of the following…

2023

If a List L=['Hello', 'World!'] Identify the correct output of the following Python command: print(*L)

  1. A.

    Hello World!

  2. B.

    Hello, World!

  3. C.

    'Hello', 'World!'

  4. D.

    'Hello' 'World!'

Attempted by 1542 students.

Show answer & explanation

Correct answer: A

Answer: Hello World!

Explanation:

  • The * operator unpacks the list into separate arguments, so print(*L) is equivalent to print('Hello', 'World!').

  • The print function joins multiple arguments using the default separator, which is a single space.

  • Therefore the actual output produced on screen is: Hello World!

Explore the full course: Rssb Senior Computer Instructor