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?
APPEARS IN
RELATED QUESTIONS
Which of the following function is used to count the number of elements in a list?
Which of the following statement is not correct?
The keys in Python, the dictionary is specified by ______
What is a List in Python?
How will you access the list elements in reverse order?
Differentiate del with remove( ) function of List.
Write a short note about sort( ).
What will be the output of the following code?
list = [2**x for x in range(5)]
print(list)
Explain the difference between del and clear( ) in the dictionary with an example.
What is the difference between List and Dictionary?
