The two multiple choice questions here are related to the Programming with Python lesson Storing Multiple Values in Lists.
You want to create a list containing elements 1,2,3,4,5, and store it in a variable named “myList”, Select the one or more python commands that will give you the list
a. myList = range(5)
b. myList = range(1,5)
c. myList = range(1,6)
d. myList = range(1,7)[0:5]
Consider the following three Python statements
What will the last print statement do ?
Explanation for Question 2’s answers
a: did not understand the slice operation returns a list
b: did not understand the list starts with 0 not 1 and slice operation returns a list
c: did not understand the specific slice operation gives list with single element
d: correct answer