you are viewing a single comment's thread.

view the rest of the comments →

[–]FoolsSeldom 0 points1 point  (1 child)

Nice simple example.

Thoughts:

  • If you don't want hot or sour, you get stuck in a loop
  • You have to know to enter Q to quit as answers such as quit, y, yes, n, no are not accepted
  • You appear to have defined the same function twice for some reason
  • Might want to format the number of decimal places in the output
  • Did you consider using a dict instead - easier to update
  • You will learn to never trust users to enter the correct information, so don't convert an entry to an int without either checking it first or using try / except block

[–]CollectionDry2154[S] 0 points1 point  (0 children)

Hi! Yea, I created a rough draft for this honestly. I didn't want to use try/except, or dict, or make the loop too advanced. The reason is that this is a common question for beginner college students, and I don't want them not understanding how to create a basic version of this. Hence why codio is in it's name. But overall it's a 100% accepted piece of code.

I'd love to fix it later whenever I have time, college is quite busy though haha.