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)
- A.
Hello World!
- B.
Hello, World!
- C.
'Hello', 'World!'
- 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!