[Tutor] Vending machine problem.

bob gailer bgailer at gmail.com
Tue Apr 1 15:15:05 CEST 2014

I'm posting this to include you in this conversation.

Recently I got the following Request: can you write me a code in python 
please or if you have one already

my response:
  print('hello world')
what more can I do for you?

  (next two lines are best guesses as I can't find the relevant emails.
Request:  can you write me a code for a vending machine  in python 
please or if you have one already
Response: I need a lot more detail.

The vending machine must have 5 prices with items
it should accept 10p, 20p 50p and £1 coins
it should allow the user to purchase a item and give him a choice of 
purchasing something else. it should display the remaining credit once 
the item is purchased. i will let you know of anything else

Tutors: sounds familiar, eh?

Response: This sounds like a homework assignment. We don't provide 
answers for homework. We will help you once you show some effort and 
tell us where you need a hand.

The requirements are kinda vague. I would have a hard time guessing 
exactly what the instructor is looking for.

Did you get any other information?

Did you get some sample of the expected input and output?

If no to the latter,  good starting place is to write down a sample 
dialog, then apply the Python functions you should have learned by now 
to make that dialog happen.

How would you store the collection of items and their prices? What 
Python data types have you learned that you could use here?

How would you look up an item to get its price?

Show us your answers to any of the above, tell us exactly where you are 
stuck, and we will see what we can do to help.

More information about the Tutor mailing list