我需要在python中做一些乘法,但我真的不明白该怎么做。
我需要显示15%和20%的账单提示,但是当我尝试这样做时,他们的代码只是不起作用。任何帮助将不胜感激!
答案 0 :(得分:0)
这是一个应该有用的快速互动脚本:
bill = float(input('What whas the bill amount? '))
tip = (float(input('What whas the tip percentage? '))/100)*bill
total = bill+tip
print('The tip amount is $'+str(tip))
print('The total amount is $'+str(total))
这应该使python语法相当清楚地进行一般数学运算,并为你提供一些构建块。
如果这回答了您的问题,请单击左侧的复选标记将其作为答案接受。