Krish
Krish

Reputation: 425

Code not outputting a value in hackerrank

I am trying to solve a hackerrank problem where I calculate the total meal cost given a base cost, tip, and a tax rate. Even when I return the correct answer in visual code, nothing is outputting when I submit it using hackerrank. https://www.hackerrank.com/challenges/30-operators/problem

def solve(meal_cost, tip_percent, tax_percent):
    tip = tip_percent*meal_cost
    tax = tax_percent * meal_cost
    total_cost = meal_cost+tip+tax
    return round(total_cost)

Upvotes: 0

Views: 103

Answers (1)

DeepSpace
DeepSpace

Reputation: 81614

From the link you posted:

Output Format

Print the total meal cost ...

So, you have to use the print function, not the return statement.

Upvotes: 2

Related Questions