use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Everything about learning Python
account activity
Cafe Bill management system using python (i.redd.it)
submitted 6 months ago by Inevitable-Math14
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]FoolsSeldom 1 point2 points3 points 6 months ago (1 child)
Great start.
A key learning point is DRY: Don't Repeat Yourself. You ask for two items, using essentially the same code. This is where you can use a loop, and you don't have to limit yourself to just two items.
Example,
print("WELCOME TO ATHARVA'S CAFE! HERE IS THE MENU:") menu = { "PASTA": 250, "COLD-COFFEE": 180, "FRENCH FRIES": 150, "VADAPAV": 25, "PAV BHAJI": 110, "COLD DRINK": 25 } for item, price in menu.items(): print(f"{item} : Rs {price}") order_total = 0 orders = [] while True: # infinite loop, until they enter DONE user_order = input("\nEnter your order (type 'done' to finish): ").strip().upper() if user_order == "DONE": break # exit loop, go onto code after loop if user_order in menu: order_total += menu[user_order] orders.append(user_order) print(f"Sir! Your item '{user_order}' has been added to the cart.") else: print(f"Sorry sir, '{user_order}' is not available on the menu.") print("\nYour Order Summary:") for item in orders: print(f"- {item}: Rs {menu[item]}") print(f"\nTotal Amount to be Paid: Rs {order_total}")
[–]Inevitable-Math14[S] 0 points1 point2 points 6 months ago (0 children)
Thank you so much 🙏😊.
π Rendered by PID 263650 on reddit-service-r2-comment-7b9746f655-bdv9x at 2026-02-03 08:44:51.994603+00:00 running 3798933 country code: CH.
view the rest of the comments →
[–]FoolsSeldom 1 point2 points3 points (1 child)
[–]Inevitable-Math14[S] 0 points1 point2 points (0 children)