In this activity, I will create the code a candy store will use in their state of the art candy vending machine!
- Create a loop that prints all of the candies in the store to the terminal with their index stored in brackets beside them.
- For example:
"[0] Snickers"
- Create a second loop that runs for a set number of times as determined by the variable
allowance
. - For example: If allowance is equal to five, the loop should run five times.
- Each time this loop runs, take in a user's input - preferably a number - and then add the candy with a matching index to the variable
candy_cart
. - For example: If the user enters "0" as their input, "Snickers" should be added into the
candy_cart
list. - Create a final loop to print all of the candies selected to the terminal.
- Create a version of the same code which allows a user to select as much candy as they want up until they say they do not want any more.