r/PythonLearning • • Sep 14 '25

First Python Program

Post image

So I started learning python some weeks ago and I created a program based on what I’ve learnt so far. So it’s a program that does age verification. What do you think about this??

387 Upvotes

47 comments sorted by

25

u/willis81808 Sep 14 '25

I would like to order -3 Whiskey please 😊

5

u/jaybee_4real Sep 14 '25

😂😂😂

7

u/Ok-Republic-120 Sep 14 '25

Cool. You just need to do something with order inputs of 0 or less, as others have already mentioned. Great job.

3

u/games-and-chocolate Sep 15 '25

Data is in real life never stored in the program memory. It must be persistant, if that is the correct word. A way, is to create a light SQL database, connect with python to it, create a receipt, that stores and prints it. That is a real life scenario. Useful.

A possible next step.

2

u/jaybee_4real Sep 15 '25

Yeah I’ll improve the program as time goes on. A gui with more features and connects to a DB

3

u/DevPrajwalsingh Sep 16 '25

I bet this wont be anybody's first program 😅

1

u/jaybee_4real Sep 16 '25

Okay let me say first proper program.. I created ones just using print statements and if clauses but no good logic.

2

u/Great_KarNac22 Sep 14 '25

Awesome! I just started and just using print and inserting comments. What course, book, site, are you using?

2

u/jaybee_4real Sep 15 '25

I’m using DataCamp

2

u/isanelevatorworthy Sep 15 '25

I think the try,except block in your while loop would exit the program if the user enters an invalid number.. that means you’d have to restart from the beginning (input user into, re-select drink, then input value).. is that how you’d like to handle that situation?

1

u/jaybee_4real Sep 15 '25

Nope.. I’ll fix that

2

u/Xzenergy Sep 15 '25

I would do a list with the bars menu, so they can choose instead of having to sanitize user input!

1

u/jaybee_4real Sep 15 '25

Yeah that’s good so the user sees the drinks available and selects them.. I’ll be making a gui for the program so the drinks will be displayed for the user to click

1

u/Anti-Hero25 Sep 14 '25

Very cool, packaging it as part of a mobile app or in a Tkinter gui for self checkout style touch screen at a bar?

3

u/jaybee_4real Sep 14 '25

I would like to make a gui for it but I’m yet to learn Tkinter

2

u/Anti-Hero25 Sep 14 '25

I mean, not to be THAT guy… but could drop your .py file in GPT5 and ask it to slap on a tkinter gui…. Run it , and dissect it , learn it that way. 🤷🏻‍♂️ That’s been my main method of learning how python works

1

u/jaybee_4real Sep 14 '25

Alright then I’ll do just that

1

u/fatimalizade Sep 15 '25

Can you also share the results?

2

u/jaybee_4real Sep 16 '25

1

u/fatimalizade Sep 16 '25

Thank you!

0

u/exclaim_bot Sep 16 '25

Thank you!

You're welcome!

3

u/Monkjji Sep 14 '25

This quite looks good and organized. However it seems that it can only make an order of the same drink.

You can further expand your program with more functionalities:

  • request different drinks in the same order.

  • make modifications to the current order.

  • read the menu from a json file (or a text file) instead of being hardcoded.

Also, depending on the target user (client or waiter), you can add the possibility of adding orders for a specific tables, and submit those orders to the "kitchen". Perhaps add the ability to view the total value of a given table.

2

u/Leninus Sep 14 '25

I would put item check before quantity, or make it a singular input statement (like "5 beer" or "beer, 5"), which would need some parsing.

2

u/Icy-Appointment1366 Sep 15 '25

Very interesting. As a first program it is all good. But don't stop there, try to enhance it even more. For example you can handle the case when a user enters 0 or below beers.

  • Make the purchased items in lower case using .lower(), better for readability.

  • Capitalize the first letter of the first name and last name.

  • Handle empty input fields as well where a user must enter a string of size >=1

  • Maybe implement GUI, it is also a good addition.

But of course, step by step. And through each step try to understand example what the feature does. Keep practicing and enjoy!

2

u/mister_w0lf Sep 15 '25

Congratulations on your start, the first of many👏🏻

2

u/nivaOne Sep 16 '25

Well done. 👍

1

u/OkraZealousideal9049 Sep 18 '25

Somehow I'm sure this isn't your first Python program 😏 Usually beginners start with programs without functions or methods, just basic prints and inputs. But here you already have def, dictionaries, try/except - definitely not your first step.

1

u/hostpari Sep 18 '25

Great 👍

1

u/alchamiwa Sep 19 '25

something I didn't see anyone mentioning above: I think I'd be good practice to test the age at the input, I'll save some teen a good 10 seconds of filings lol

1

u/Diamanthau Sep 20 '25

I see using def that’s not necessary because it’s only used one place. Did u do it for practice?

1

u/[deleted] Mar 15 '26

Very nice block of coding! I would like 1 whiskey, please and thank you!

0

u/liberforce Sep 15 '25

Create functions for everything and have a single main() function call the whole logic. Like:

def main(): ....

if name == "main": main()

0

u/[deleted] Sep 14 '25

[deleted]

3

u/jaybee_4real Sep 14 '25

Alright noted

1

u/kureii23 Sep 15 '25

Why, you need slow down Python?

3

u/[deleted] Sep 15 '25

[removed] — view removed comment

4

u/[deleted] Sep 14 '25

[removed] — view removed comment

3

u/Leading-Concept- Sep 14 '25

Or put .lower() on the input

2

u/unsettlingideologies Sep 16 '25

Couldn't you use .title to capitalize the first letter only? So it would match the menu?

3

u/Leading-Concept- Sep 16 '25

Right yeah, if you use .lower() you would have to put the menu all in lowercase, if you use .title you can keep the menu as it is now!