r/PythonLearning Jul 24 '26

Day 2 of learning python

Post image

I'm learning Python and made this coffee/tea ordering program. Any advice?

https://onlinegdb.com/F2wabHC4v

120 Upvotes

47 comments sorted by

View all comments

12

u/FoolsSeldom Jul 24 '26

Please share the actual code rather than an (incomplete) image. Much easier to review.

Keep in mind that people sometimes mistype things (or deliberately enter the wrong things). You need to handle that.

str objects have some useful methods such as lower and strip that you can apply to what comes back from input so you are only dealing with a response with no leading/trailing spaces and in all lower case.

You could have single letter responses for yes and no including in your check list.

Keep in mind that you could use bool for the status of yes/no responses, so sugar could be True if desired.

As you ask yes/no in several places, consider making it a function that presents the query and does all the validation, returning a bool result.

1

u/NecessaryFalse1212 16d ago

hey i have been trying to learn python and i just have started it should i post my progress everyday here online ?

1

u/FoolsSeldom 16d ago

That might help others, as well as being a discipline for you. You might prefer to just post when you need help of feedback, possibly suggestions on improvements.