运行一直报错孩子也不知怎么回事那
建议用新语法,,比如f'{tax}aadfasdfa{tip}'
你字符串不要分成两个,要写成一个字符串
你题目的解答代码如下:(如有帮助,望采纳!谢谢! 点击我这个回答右上方的【采纳】按钮)
TAX_RATE=0.05
TIP_RATE=0.18
cost=float(input("enter the cost of the meal:"))
tax=cost*TAX_RATE
tip =cost*TIP_RATE
total=cost+tax+tip
print("the tax is %.2f and the tip is%.2f,making the\ntotal %.2f" % (tax,tip,total))
你两段字符串分开了,连在一起重跑一下试试