@Python_Dv I'm comfortable with match cases. For this tip, I would have used the anonymous function. getPrice = lambda food_item: { "Burger": 100, "Pizza": 200, "Juice": 50, "Tofu": 150 }.get(food_item, None)
@Python_Dv Nice use of the dictionary! You can even load items from a file later with minimal changes.
@Python_Dv Hmm but I don’t think so let’s say u creating a huge object is u use this method u create all of them which consume so much time
@Python_Dv Great tip! Python makes coding feel so much easier. Thanks for sharing!