Dictionaries
catch = { 'type': 'herring', 'quantity': 100 }
fresh = catch
catch[ 'quantity' ] = 22
print( fresh[ 'quantity' ] )
Email address *
Is the variable 'fresh' an alias or a copy of the 'catch' variable in the above code?
1 point
Clear selection
Which data types can be used as keys in a dictionary item?
1 point
Are dictionaries a mutable or immutable data structure?
1 point
Clear selection
What value is printed to the console by the above program?
1 point
Clear selection
Which statement would remove the item with they key 'type' and the value 'herring' from the dictionary in the program above?
1 point
Clear selection
Which data type could the variable 'flo' possibly refer to in the expression, « flo[ 3 ] », if it produces no error?
1 point
Which statement would add an item with they key 'pickled' and the value 'True' to the dictionary in the program above?
1 point
Clear selection
If the second line the program above was changed to « fresh = catch.copy() », would the 'fresh' variable be an alias or a copy of the 'catch' variable?
1 point
Clear selection
Which data types can be used as values in a dictionary item?
1 point
Do Dictionaries have a reverse() modifier method?
1 point
Clear selection
Are the values in a dictionary ordered or unordered?
1 point
Clear selection
Next
Never submit passwords through Google Forms.
This form was created inside of New York University.