We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Day 2: Operators
Day 2: Operators
Sort by
recency
|
3363 Discussions
|
Please Login in order to post a comment
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): b=(meal_cost/100)*tip_percent c=(meal_cost/100)*tax_percent sums=(meal_cost+b+c) a=int(sums) print(a) # Write your code here
if name == 'main': meal_cost = float(raw_input().strip())
JAVA Solution.
class Result {
}
// Write your code here double totalcost = meal_cost+((meal_cost*tip_percent)/100)+((meal_cost*tax_percent)/100); int costtotal = (int) Math.round(totalcost) ; System.out.println(costtotal); }
javascript
I don't understand why Math.round gives an answer that passes the third test case but casting your answer to an int doesn't.