Python code Dinner Calculator based on Tip Percentage

 Dinner Calculator based on Tip Percentage:

Below is the program that helps you calculate the amount per person for a dinner including the Tip you have given. Please note that the Tip in this program is based on certain amount of percentage by comparing it with the  bill. 

For Eg: 

If your bill is Rs.200 and your tip is 10%, then your tip will be 10% of Rs.200 which is Rs.20. The Total bill will be Rs.220 and the amount will be shared based on the no of persons.

Below is the Code:
print("Welcome to the PGRSpot Dinner Calculator based on Tip Percent: \n")
bill = float(input("Enter your Bill amount: \n"))
no_of_persons = int(input("Enter the no_of persons: \n"))
tip_question = input("Do you want to give tip, 'Y' or 'N' \n").lower()

print(tip_question)

if tip_question == "y":
    tip_percent = float(input("Enter the tip percent you wnat to give:"))
    tip = bill * tip_percent/100
    total_bill = bill + tip
    amount_per_person = total_bill / no_of_persons
    print(f"Your total bill is {amount_per_person}")
    
elif tip_question == "n":
    total_bill = bill
    amount_per_person = total_bill / no_of_persons
    print(f"(Amount per person: {amount_per_person})")
    

Post a Comment