English

What will be the result of the following Python code? S = [x**2 for x in range(5)]print(S)

Advertisements

Question

What will be the result of the following Python code?

S = [x**2 for x in range(5)]
print(S)

Options

  • [0,1,2,4,5]

  • [0,1,4,9,16]

  • [0,1,4,9,16,25]

  • [1,4,9,16,25]

MCQ
Advertisements

Solution

[0,1,4,9,16]

shaalaa.com
Introduction to List
  Is there an error in this question or solution?
Chapter 9: Lists, Tuples, Sets and Dictionary - Evaluation [Page 167]
Advertisements
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×