What will be the output of the following code? | List Que. 30

30. What will be the output of the following code?

L1=[10,100,1000,10000]
print(L1*2)
  1. [20, 200, 2000, 20000, 20, 200, 2000, 20000]
  2. [10, 100, 1000, 10000, 10, 100, 1000, 10000]
  3. [20, 200, 2000, 20000]
  4. Error

Answer: B) [10, 100, 1000, 10000, 10, 100, 1000, 10000]

Explanation:

When you multiply the whole list with some integer then it repeats the elements that number of times so here the output will be [10, 100, 1000, 10000, 10, 100, 1000, 10000].

Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.