1]How many elements are in the list quizScores?
1)quizScores.length()
2)quizScores.length
3)len(quizScores)
4)quizScores.num_elements
-------------------------------------------
2)A list has the number of days in the month.
days = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
How would I display the number of days in March?
Group of answer choices
a)days[3]
b)days[2]
c)days[4]
d)days['March']
----------------------------------
3)A dictionary is created with the number of days in each month.
days = {'Jan' : 31, 'Feb' : 28, 'Mar' : 31, 'Apr' : 30, 'May' : 31, 'Jun' : 30, 'Jul' : 31, 'Aug' : 31, 'Sep' : 30, 'Oct' : 31, 'Nov' : 30, 'Dec' : 31}
How would in display the number of days in June?
Group of answer choices
a)days[6]
b)days[5]
c)days['June']
d)days['Jun']
1)Answer)
len(quizScores)
Reason : there is a function in python to find the size of the list.
/***************************************/
2)Answer)
days[2]
Reason : the index of the list starts from 0 to n-1
As the march is the 3rd month of the year,if we want to display the no of days in that list we have to use days[2]
/***************************************/
3)Answer)
days['Jun']
Explanation : If we want to display the value in the dictionary then we have to use the corresponding key.
As we want to display the no of days in the month of june , we have to use the key 'Jun'.So the answer is days['Jun']
/***************************************/
Get Answers For Free
Most questions answered within 1 hours.