+ 1
Why do i get a different outputs when i run the same code in shell and pycharm??
1. I was working with dictionaries I ran a code in shell and got an output . 2. I ran the same code in pycharm just to cross check but I got a different output. https://code.sololearn.com/cwQERQZyoGv5/?ref=app
1 Resposta
+ 2
{8: 64, 1: 1, 2: 4, 3: 9, 4: 16} This, or something like this is the appropriate output. Dictionaries are not ordered by index like a List would be. The key value pairs may output in any order. So the next time you run:
print(squares)
the output may be:
{1: 1, 2: 4, 3: 9, 4: 16, 8: 64}
or
{1: 1, 8: 64, 2: 4, 3: 9, 4: 16}
etc