[Tutor] variable * raw_input

Eric Brunson brunson at brunson.com
Thu Aug 9 17:48:53 CEST 2007


Dewight Kramer wrote:
> Hello,
>
> So i am new to Python, and really to programming.  I picked up book  
> and so far I like it. right now I am trying to figure out a problem  
> that I cant.
>
> It is a tipping program and I have assigned certain words to be a  
> certain % and then I ask the user to type raw input of one of those  
> names.   After which I am trying to mutiply the Bill by the Service  
> quality.  But I dont understand something below is code.
>
> Thanks
> D
>
> # Tip Calulator - Ver
> # Challenges Ch2 - Question 3
> # Developed by, Dewight
> # Developed on, 8/7/2007
>
>
> # establish variables
> bill = float(0.0)
> bad = float (0.0)
> ok = float(0.10)
> good = float (0.15)
> great = float (0.20)
>   

Speaking as a former waiter, this should probably read:

great = float (0.25)
good = float (0.20)
ok = float(0.15)
bad = float (0.10)
eatathomeyoucheapskatebagofcrap = float(0.0)


;-)

I now return you to your regularly scheduled Python discussion.

> service="nothing"
> tip = float ()
> total = float ()
>
> print "This is a tipping calculator."
>
> bill = raw_input ("\nWhat was the total bill amount?  ")
> service = raw_input("Please input one of the following to"+
>                      " discribe the service:"+"\nbad\nok\ngood\ngreat 
> \n")
>
> tip = bill * service
> total = bill + tip
> print "Then you should leave a" + tip + "tip. This will bring the  
> total to" + total +"."
>
>
> raw_input("\n\nPlease press enter to exit.")
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>   



More information about the Tutor mailing list