-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDay2-Operators.py
36 lines (27 loc) · 953 Bytes
/
Day2-Operators.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/python3
import math
import os
import random
import re
import sys
#
# Complete the 'solve' function below.
#
# The function accepts following parameters:
# 1. DOUBLE meal_cost
# 2. INTEGER tip_percent
# 3. INTEGER tax_percent
#
def solve(meal_cost, tip_percent, tax_percent):
# Write your code here
tip_dec = tip_percent/100 # Convert tip integer to decimal value
tip_total = meal_cost * tip_dec # Calculate amount of tip
tax_dec = tax_percent/100 # Convert tax integer to decimal value
tax_total = meal_cost * tax_dec # Calculate amount of tax
total = meal_cost + tip_total + tax_total # Calculate total meal cost
print(round(total)) # Round to nearest integer, as required by problem
if __name__ == '__main__': # Provided by problem
meal_cost = float(input().strip())
tip_percent = int(input().strip())
tax_percent = int(input().strip())
solve(meal_cost, tip_percent, tax_percent)