Tip Calculator - Python Project

 Day - 2 

Welcome to the Day-2 Project of 100 days of Python.

In this project we will see different types of 

  1. "Data Types", 
  2. "Assigning Variables", 
  3. "Math Functions" 
  4.  "Operators"
Before getting into Coding we will see, What are the requirements and what we havt to do?

Findings : 

  1. What is the total bill amount?
  2. What percentage of Tip you want to pay to the Waiter ?
  3. How many people will Split the Bill?
  4. Show the result How much each have to Pay?

Let's Begin with the Code then -

TIP CALCULATOR



#print the name of the Project
print("!!! WELCOME TO THE TIP CALCULATOR !!!")

#Prompt the user for total bill Statement
totalBill = float(input("What is the total bill amount ? Rs. "))

#ask the user amount of Percentage you want to give as a Tip
percentBill = float(input("What percent you want to give the Tip ? \n10 % \n15 % \n20% "))

#Ask the user how many members will split the bill?
split = input("How many persons you want to split the bill into ?")

#Calculate the Percentage according to the Tip you have provided
tip = float(percentBill) * (float(totalBill)/100)

#Add the Amount and Split the Bill to around of 2 decimals
totalAmt = totalBill + tip
billSplit = float(totalAmt)/float(split)
#stores upto 2 decimals
x = round(billSplit,2)

#Print the Statement with the Amount to pay by each member
print(f"All of you can divide and pay the bill of Rs. {x}")

OUTPUT

Hope You all tried and Enjoyed coding this Project. Feel Free to comment for any Queries and Doubts.
!!! Happy Coding !!!

Post a Comment

Previous Post Next Post