M

Mr. Dubey • 100.28K Points
Coach

Q. What will be the output of this code?

Code:
x = [1, 2, 3]
print(x * 2)
  • (A) [1, 2, 3, 1, 2, 3]
  • (B) [2, 4, 6]
  • (C) [1, 2, 3, 2]
  • (D) Error
  • Correct Answer - Option(A)
  • Views: 16
  • Filed under category Python

Explanation by: Mr. Dubey
Multiplying a list by an integer repeats the list.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.


Question analytics