0

In Python 3.6:

d = {0: None}
for i in d:
    del d[i]
    d[i+1] = None
    print(i)

The output is

0
1
2
3
4

In Python 2.7 the output goes up to 7. What causes this output?

user1717828
  • 7,122
  • 8
  • 34
  • 59

0 Answers0