[Tutor] Python Help

Adam Eyring adameyring at gmail.com
Fri Oct 26 13:20:15 EDT 2018


Try this cleaned up version with colons in the right places, dollar signs
removed, and other corrections:

beefmeals=int(input("Enter number of beef meals: "))
shitmeals=int(input("Enter number of vegan meals: "))
party = beefmeals + shitmeals
print("Total meals", party)
a = 0
b = 0
c = 0
if party <= 50:
    a=75
    print("Room cost $75")
elif party <= 150:
    b=150
    print("Room cost $150")
else:
    c=250
    print("Room cost $250")
roomtax = party * 0.065
print("Room tx", roomtax)
print("Beef Meals", beefmeals)
beef = (beefmeals * 15.95)
print("Beef cost", beef)
print("Vegan Meals", shitmeals)
shit = (shitmeals * 10.95)
print("Vegan cost", shit)
cost=(beef + shit)
grat= cost * 0.18
print("Gratuity", grat)
GT = print("Grand total", grat + beef + shit + a + b + c)

On Fri, Oct 26, 2018 at 7:28 AM Bob Gailer <bgailer at gmail.com> wrote:

> On Oct 26, 2018 6:11 AM, "Ben Placella" <benjamin.placella at maine.edu>
> wrote:
> >
> > I need to write code that runs a  cost calculating program with many
> > different variables and I honestly don't understand it
>
> Could you be more specific? What exactly don't you understand, or even
> better what do you understand?
>
> my code is:
>
> How could you have written so much code without understanding it?
>
> > beefmeals=int(input("Enter number of beef meals: "))
> > shitmeals=int(input("Enter number of vegan meals: "))
> > party=beefmeals+shitmeals
> > print(party)
> > if party<=50
>
> Something is missing from that last statement. Can you tell what it is? Do
> you know how to find out? Hint use help.
>
> Hint 2 it is also missing from the elif and else statements.
>
> > a=75
> > print("Room cost $75")
> > elif party <=150
> > b=150
> > print("Room cost $150")
> > else
> > c=250
> > print("Room cost $250")
> > roomtax=party*0.065
> > print(roomtax)
> > print("Beef Meals", beefmeals)
> > $beef=(beefmeals*15.95)
> > print($beef)
> > print("Beef cost", $$beef)
> > print("Vegan Meals", shitmeals)
> > $shit=(shitmeals*10.95)
> > print($shit)
> > cost=($beef+$shit)
> > grat=cost*0.18)
> > print(grat)
> > GT=(grat+$beef+$shit+(a,b,c))
>
> There is a convention in Python that and all uppercase name is a constant.
> This is not a requirement.
>
> > print(GT)
> >
> > This is what the output is supposed to be:
>
> I don't see any output here. Alan''s responses may help you figure that
> out.
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>


More information about the Tutor mailing list