Q. What is the output of [1, 2] * 2?

A
[1, 2, 1, 2]
B
[2, 4]
C
[1, 2, 2]
D
Error
Solution:

The * operator repeats the list, so [1, 2] * 2 becomes [1, 2, 1, 2].

Entri Contact Image

Get Expert Advice for Free: Register for Your Free Consultation Now!