Python Forum
Why this reverse lookup function not working
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Why this reverse lookup function not working
#5
(May-31-2020, 05:48 AM)buran Wrote: input returns str and the values in the dict are int, so the user input and [any] value from the dict will never be equal.
Do you really want to print 'not found' for each not equal value? Also there are better ways to iterate over dict:
for key, value in dict.items():
    # do something with key and value
Thanks. This solution is more intuitive and it worked.
Reply


Messages In This Thread
RE: Why this reverse lookup function not working - by Emekadavid - May-31-2020, 05:54 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Reverse Function in Python Voraman 7 3,333 Feb-13-2021, 07:21 PM
Last Post: Voraman
  GUI and function not working together albry 2 2,599 Jan-15-2019, 07:32 AM
Last Post: albry
  Function not working as intended I think? TimeForged 2 3,083 Mar-11-2018, 09:05 AM
Last Post: buran
  [split] Function not working as intended mihshyahoocom 1 2,120 Mar-11-2018, 09:04 AM
Last Post: buran

Forum Jump:

User Panel Messages

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