Thursday , September 19 2024

How many elements does the lst list contain? lst = [i for i in range(-1, -2)]

Questions BankCategory: Python Essentials 1How many elements does the lst list contain? lst = [i for i in range(-1, -2)]
How many elements does the lst list contain?

lst = [i for i in range(-1, -2)]
  • three
  • two
  • zero
  • one

Explanation: The lst list is empty, because the range() function, which consists in of the list comprehension, sets the start parameter with the initial value of -1 and the stop parameter with the initial value of -2 (the stop parameter has a lower value than the start parameter, which makes it impossible to create a sequence).

More Questions: Python Essentials 1 (PE1) Course Final Test