NO MORE MATH IN PUBLIC
Needless to say, most do not like doing math in public!
The solution? Day 2 of the “100 Days of Coding” Challenge creates a helpful tip calculator anyone can access and use when paying a bill. You can split the amount amongst a group of people or pay in full. It does all the calculations for you.
My number one rule is that coding of any kind needs to be useful. This calculator is certainly “useful”!
UNDERSTANDING THE MATH
Python conducts calculations using PEMDAS and this coding exercise reinforces the correct usage and order of mathematical operations.
My husband, a US Air Force veteran, engineer, and current high school math teacher, often mentions PEMDAS. So it is an all too familiar term in our household.
PEMDAS refers to (Parathesis, Exponents, Multiplication/Division, Addition/Subtraction – left to right) as the proper order of operations in a mathematical equation.
For me, I learned this concept with the (Please Excuse My Dear Aunt Sally) acronym.
If you need more information on PEMDAS, Kahn Academy’s video explains the proper order of mathematical operations in full detail.
However, this tip calculator adds the tip, divides it out, and prints the dollar amount each owes, rounded to the nearest hundredth, including trailing zeroes.
REAL WORLD APPLICATION
I can see the real-world applications of this coding. The tip calculator currently presents itself in many apps used by companies and professionals today.
Many small service businesses take payments on their smartphone or tablet. So next time you pay for a service, such as your hair cut or dog grooming, you can recognize that their application was most likely coded with Python.
THE ENCOURAGEMENT
This is Day 2 for me in the “100 Days of Code” Challenge.
I took a small break during the Christmas Holidays, but now I am excited to start the new year back in full swing.
As I plug along on this coding journey, I am finding that coding skills build on top of one another. As I continue to learn, my encouragement is from a Udemy training class “100 Days of Code- The Complete Python Pro Bootcamp for 2021”, by Dr. Angela Yu. Check it out if you find coding intriguing. The cost of the class is minimal, and it is designed for all skill levels from beginner to advanced.
If you missed Day 1 of this Challenge, click HERE to see how it all started.
TIP CALCULATOR – DAY 2
Ok . . . this project is still pretty basic, but it works! Check out my working tip calculator.
You can even bookmark this page on your phone and next time you need to figure out the appropriate tip amount and/or split the bill, you have a great tip-calculator to use.
This coding allows the user to answer questions, bill amount, tip amount, and the number of people that are paying. The results display the amount each person should equally pay.
(My husband recommends adapting the code to only calculate the tip on the actual service or product and not the taxes. Good idea – maybe at a later time.)
Give it a try- to start click the green arrow below.