Tip Calculator

Essentially for our first homework, we were to complete the assignment called “Tip Calculator” from www.Codeacademy.com. The first step of the assignment allowed us to practice creating variables in python. We were instructed to create a variable for the amount of tax on a meal, and in order to do that we had to write out the name of the variable, (tax) and set it equal to the decimal value of a percentage given (6.75%). Therefore, in order to create a variable, we had to write out the following tax = .0675. While doing this, I had to keep in mind I had to convert the percentage into a decimal.

brygetee2

After creating the variable for tax, we needed to compute how much a tip of 15% would be if the meal costed $44.50 and the tax was 6.75% (the previous variable we created). However, before we did this computation, we would need to create another variable, label it as tip, and set it to the decimal value of 15%. In order to create this variable, we would need to do the same thing we did for creating the variable tax, which was to type tip = .15. One thing during this step that confused me was having to realize that “=” did not mean equal to, but it meant assigning a value to  a variable.

brygetee3

The third step of this process was to reassign the value of the variable “meal” in order to calculate the entire price of the meal, including tax . In order to do this, we needed to type out, “meal = meal+meal*tax” this part of the assignment allowed us to call a variable in the same variable while also changing it’s value.

brygeteeassignment1pic

In the next step, we were instructed to create a new variable called “total” where we would need to set it equal to the value of “meal+meal*tip” this would look like total = meal + meal *tip. This would basically give us the total cost of a meal, including tax and tip.