+ 3
There are no indexes in a dictionary, just keys. So squares[ key ] == value ( If you put something in the [] that is not in dictionary like squares [ "anything" ] It will give a "key" error not "index" out of bound )
14th Apr 2020, 6:56 PM
Utkarsh Sharma
Utkarsh Sharma - avatar
+ 2
squares is a dictionary. Where the value to the left of the colon : is the key to access the items value to the right of the colon. squares[8] = 64 and squares[3] = 9 Will change the value to the right of the colon if the item with the given key exists, or it will append the item to the dictionary if it does not. The value in the brackets [ ] is the key and the value to the right of = is that items value.
14th Apr 2020, 6:59 PM
ChaoticDawg
ChaoticDawg - avatar
0
K
19th Mar 2021, 12:40 PM
Muhammad Rehaan
Muhammad Rehaan - avatar