Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dictionary Problem
#3
(Apr-23-2023, 02:15 AM)deanhystad Wrote: If you want to get the cost of an item.
item_cost = menu[item]
That is it. No looping. No looking at items. No converting the "cost" to a string, stripping out "super" and converting back to a float.

Yeah, the whole strip("super") was an admittedly far-fetched attempt to work around the issue, but I see what you're saying. Like I said, I'm very new to all of this (coding in general, not just python) so I think I'm just over-complicating everything.

But I was able to take what you said and it now works as it should, so thank you for your help!
Reply


Messages In This Thread
Dictionary Problem - by Chief816 - Apr-23-2023, 01:31 AM
RE: Dictionary Problem - by deanhystad - Apr-23-2023, 02:15 AM
RE: Dictionary Problem - by Chief816 - Apr-23-2023, 02:23 AM
RE: Dictionary Problem - by deanhystad - Apr-23-2023, 02:37 AM
RE: Dictionary Problem - by DeaD_EyE - Apr-24-2023, 10:00 AM

Forum Jump:

User Panel Messages

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