Python: Financial Application: Calculate Tips

less than 1 minute read

The code has been modified slightly and now uploaded to the site.

The questions are from the C++ Textbook.

Question

<— Return Home

25.py

subtotal = float(input("Enter the subtotal and a gratuity rate: "))
gratuity_rate = float(input())
to_gratuity = subtotal * (gratuity_rate / 100)
total = subtotal + to_gratuity
print("The gratuity is " + str(to_gratuity) + " and the total is " + str(total))

<— Return Home