Python Forum
python dictionary is that a bug ?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
python dictionary is that a bug ?
#1
"PLEASE IGNORE THIS POST....I MADE A MISTAKE I CAUGHT MY OWN ERROR"

I created below dictionary and then printed values for all the keys

d={0:0,1:1,2:2}

print(d[0])
print(d[1])
print(d[2])

Strangely i get following outputs
0
True (if this is correct then why for 0 it did not give as False)
2
Reply
#2
I can't reproduce the bug
>>> d={0:0,1:1,2:2}
>>> 
>>> print(d[0])
0
>>> print(d[1])
1
>>> print(d[2])
2
>>> 
I don't think this bug is possible at all. What is your OS, python interpreter, etc? And make sure you post the exact code that was ran, with the exact output.
Reply
#3
(Sep-27-2023, 04:34 AM)Gribouillis Wrote: I can't reproduce the bug
Works as it should, no problems (Win 11, python 3.11.2, idle)
Paul
It is more important to do the right thing, than to do the thing right.(P.Drucker)
Better is the enemy of good. (Montesquieu) = French version for 'kiss'.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Convert List of Dictionary to dictionary of dictionary list in python kk230689 2 51,946 Apr-27-2019, 03:13 AM
Last Post: perfringo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020