代码未在hackerran中输出值

2024-06-15 04:47:22 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图解决一个hackerrank问题,在这个问题上,我根据基本成本、小费和税率计算总餐费。即使我以可视代码返回正确答案,当我使用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)

Tags: 答案代码https内容total成本taxpercent