Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1.) A list contains 12 elements. So ____. the range of indexes is 0 to 11 the ra

ID: 2246787 • Letter: 1

Question

1.) A list contains 12 elements. So ____.

the range of indexes is 0 to 11

the range of indexes is 1 to 12

the range of indexes is 0 to 12

the range of indexes is 0 to 13

2.) To access the 3rd thing in a dictionary named cars you'd _____

not be able to do this

use cars[3]

use cars[2]

use cars['2']

3.) If not all parameters have default values then any default parameters must all go at the end of the parameter list.

True

False

4.)

This is how you unpack a list.

m = [23, 45, 31]
m => x, y, z

True

False

5.) A function named calc takes two integer arguments and returns the integer sum. Which of the following is the correct call to the funciton?

total = calc(2, 3)

total = calc()

total = calc(2)

total = calc("2", "3")

6.) How do you search a dictionary named menu for a key but providing a default value in case it is not found?

food = menu.get("Fri", "seafood")

food = menu.get(["Fri"],"seafood")

food = menu(["Fri"], "seafood")

food = get("seafood", "Fri")

the range of indexes is 0 to 11

the range of indexes is 1 to 12

the range of indexes is 0 to 12

the range of indexes is 0 to 13

Explanation / Answer

1) the range of indexes is 0 to 11 (lists always starts at 0 index)

2) Not able to do this (because dictionary is not index base it is key based if don't know the key you can't do it)

3)TRUE (Once default value is used for an argument, all subsequent arguments must have default value.)

4) FALSE

5) total = calc(2,3)

6)food = menu.get("Fri", "seafood")