Ultra-noob question


Hi Everyone,

I was hoping someone could help me with an ultra-noob question, I’m learning to code for a future career and Python is the best most used language for my profession as a result here I am!

It’s my 3rd day learning so yes, I’m an ultra-noob! :’) I started the second lesson of python fundamentals and I’ve been asked to start to learn how to create a calculator.

Given one of the exercises as shown here: https://gyazo.com/02cbb2f400a3c0f864b0263bfd4e95f4

I’m really confused!

I’ve added the value to the variable meat, but later on I’m asked to total up the tax and tip ontop of the meal as follows:
meal = meal + meal * tip

Why do i need to put meat twice? I thought it would be “meal = meal * tip?” Since meal already has the tax added all that is needed is to add the tip ontop?

I hope this makes sense, i may have confused my self and now everyone else :’)

Thanks for your help everyone!


Hi @shaundor

First, let’s make sure you are using the correct names for the variables. Then we can go into the details of answering your question.

Is this what you have? …

meal = meal + meat * tip

The statement should contain meal where you have meat.



yes sorry i was hungry and I put meat instead of meal! Argh! :’)

I meant to say “meal = meal + meal * tip”
I’m confused to why i have to repeat meal twice? :frowning:


No, that would replace the value of meal by the tip only.

Let’s suppose that just prior to computing the tip, the cost of some meal was $100.00. With a tip rate of 15%, or 0.15, the tip should come to $15.00. The total of the tip and the meal should be $115.00.

To compute that total, multiply the tip rate by the cost of the meal, which gives us $15.00, and add that to the cost of the meal, which is $100.00, giving us a total of $115.00.

Now we’ll visit a less expensive restaurant. Prior to the statement about which you are asking, some assignments were made, as follows. Note the comments …

meal = 44.50 # cost of meal prior to tax and tip
tax = 6.75 / 100 # tax rate of 0.0675,which is 6.75%
tip = 15.0 / 100 # tip rate of 0.15, which is 15%

To compute the tax, we multiply the meal cost times the tax rate, so it is meal * tax. We need to add that tax to meal and assign the result to meal, replacing the previous value, as follows …

meal = meal + meal * tax

The tip is the tip rate times the cost of the meal, so it is meal * tip. We add that to meal, and assign the result to meal, replacing the previous value, as follows …

meal = meal + meal * tip


Right i get it!! Thank you soo much! I was really scratching my head on this one! :smiley: