+ 1

(Python) Can I iterate through a dictionary like this?

Is it the right way to iterate through a dictionary like this? squares = {1: 1, 2: 4, 3: 9, 4: 16,} for i in squares: print(i,"=", squares[i])

14th Oct 2020, 10:55 AM
Sam
Sam - avatar
1 Antwort
+ 3
yes, you can insert that code into codeplaygrpumd to see for yourself
14th Oct 2020, 11:23 AM
Roderick Davis
Roderick Davis - avatar