0% found this document useful (0 votes)
47 views1 page

Calculate Restaurant Tips in Python

The document demonstrates a Python script that calculates tips based on a restaurant bill total. It prompts the user to enter the bill amount and calculates both 15% and 20% tips. The results are then displayed formatted to two decimal places.

Uploaded by

Mayank tomer
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views1 page

Calculate Restaurant Tips in Python

The document demonstrates a Python script that calculates tips based on a restaurant bill total. It prompts the user to enter the bill amount and calculates both 15% and 20% tips. The results are then displayed formatted to two decimal places.

Uploaded by

Mayank tomer
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Python 3.11.9 (tags/v3.11.9:de54cf5, Apr 2 2024, 10:12:12) [MSC v.

1938 64 bit
(AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>> bill_total = float(input("Enter the restaurant bill total: "))
Enter the restaurant bill total: 1235
>>> # Calculate the 15% tip
>>> tip_15_percent = bill_total * 0.15
>>>
>>> # Calculate the 20% tip
>>> tip_20_percent = bill_total * 0.20
>>>
>>> # Display the tip amounts
>>> print("15%Tip: Rs",format(tip_15_percent,'.2f'))
15%Tip: Rs 185.25
>>> print("20%Tip: Rs",format(tip_20_percent,'.2f'))
20%Tip: Rs 247.00

You might also like