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
#4
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 some_dict.items():
    # do something with key and value
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


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

Possibly Related Threads…
Thread Author Replies Views Last Post
  Reverse Function in Python Voraman 7 3,376 Feb-13-2021, 07:21 PM
Last Post: Voraman
  GUI and function not working together albry 2 2,626 Jan-15-2019, 07:32 AM
Last Post: albry
  Function not working as intended I think? TimeForged 2 3,122 Mar-11-2018, 09:05 AM
Last Post: buran
  [split] Function not working as intended mihshyahoocom 1 2,142 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