+ 1
The output in the module: Dictionary Functions:1 ---->is wrong
squares = {1: 1, 2: 4, 3: "error", 4: 16,} squares[8] = 64 squares[3] = 9 print(squares) //The output is supposed to be: {1: 1, 2: 4, 3: 9, 4: 16, 8: 64}
1 Respuesta
+ 1
The output seems fine to me.
Unless you are referring to the order in which it was returned?
Dictionary ordering is not linear like a list. In the background, python does put some sort of order. But it wouldn't be 1, 2, 3...etc for the keys.