[Tutor] Coding

Danny Yoo dyoo at hashcollision.org
Mon Dec 8 02:52:28 CET 2014

On Sun, Dec 7, 2014 at 7:27 AM, Awais Idris <2010-3902 at slougheton.com> wrote:
> Hi there, I'm currently in secondary school yr 11 studying the computing
> course and I've been set a task in creating a vending machine code. I found
> some coding online and I have changed some of it, but it still doesn't work.
> I think theres a problem with the loops and a few other things that I cant
> put my finger on. I was wondering if you could help me by fixing the code
> for me. this would be a massive help.

We will try to help you understand your problems.  But you are
responsible for fixing your program, not us.

There's a difference between a tutor and a contractor.  A tutor helps
you to learn to do your job.  A contractor does the job for you.  A
tutor is not a contractor.

Can you describe what you mean by "doesn't work"?  Do you see an error
message?  What behavior do you think is wrong, and why?

I will point out a possible mistake that you are making a few times in
your program:  I see the following:

    if FirstChoice == 'Coke' or 'Pepsi' or 'Water': ...

I will try to paraphrase what Python will take as the meaning of this statement.

       FirstChoice == 'Coke' is a true value,
       or if 'Pepsi' is a true value,
       or if 'Water' is a true value,
     then do the following: ..."

Does this match what you are trying to do?

More information about the Tutor mailing list