[Tutor] Python Help

Steven D'Aprano steve at pearwood.info
Fri Oct 26 06:47:27 EDT 2018

On Thu, Oct 25, 2018 at 06:14:41PM -0400, Ben Placella wrote:
> I need to write code that runs a  cost calculating program with many
> different variables and I honestly don't understand it, my code is:
> beefmeals=int(input("Enter number of beef meals: "))
> shitmeals=int(input("Enter number of vegan meals: "))

What version of Python are you using?

> party=beefmeals+shitmeals
> print(party)
> if party<=50
> a=75

You have lost the indentation, making your code invalid.

Also, you are probably getting a SyntaxError when you try to run your 
code. As always, please COPY AND PASTE (don't retype it from memory, or 
take a photo) the entire traceback, starting from the line 
"Traceback..." and ending with the error message.

> print("Room cost $75")
> elif party <=150
> b=150
> print("Room cost $150")
> else
> c=250
> print("Room cost $250")

That's two more syntax errors.

> $beef=(beefmeals*15.95)

Dollar signs aren't used for Python variables.

More information about the Tutor mailing list