πŸ“Š Problem Solving and Python Programming
Q. Write a list comprehension to produce the list: [1, 2, 4, 8, 16……212].
  • (A) [(2**x) for x in range(0, 13)]
  • (B) [(x**2) for x in range(1, 13)]
  • (C) [(2**x) for x in range(1, 13)]
  • (D) [(x**2) for x in range(0, 13)]
πŸ’¬ Discuss
βœ… Correct Answer: (A) [(2**x) for x in range(0, 13)]

Explanation: the required list comprehension will print the numbers from 1 to 12, each raised to 2. the required answer is thus, [(2**x) for x in range(0, 13)].


Explanation by: Mr. Dubey
the required list comprehension will print the numbers from 1 to 12, each raised to 2. the required answer is thus, [(2**x) for x in range(0, 13)].

πŸ’¬ Discussion

πŸ“Š Question Analytics

πŸ‘οΈ
317
Total Visits
πŸ“½οΈ
2 y ago
Published
πŸŽ–οΈ
Mr. Dubey
Publisher
πŸ“ˆ
92%
Success Rate