[Tutor] How to calculate the total cost

Alan Gauld alan.gauld at btinternet.com
Wed Mar 30 15:30:04 EDT 2016


On 30/03/16 13:43, Nevina Dias via Tutor wrote:
> import random 
> import time 
> 
> print ("Welcome to Pizza Shed!") 
> 
> tablenum = input ("Enter table number from 1-25 \n ") 
> while tablenum>25 or tablenum <=0: 
>     tablenum = input ("Enter the correct table number, there are only 25 tables ") 

Assuming you are using python v3 you have more serious problems
to solve first. Try to get you existing code to run then we
can consider how to add all the different totals.
Hint: The sum() function might help.

In particular input() in v3 doesn't do what you seem to
think it does.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list