我的第二个问题是基于服务创建一个小费计算器。如果服务很棒,那就给20%的小费,如果可以的话,给15%的小费,如果糟糕的话,给10%的小费。在
编辑:来自Raj的评论on the other post和他的代码:
以下是我对这些问题所做的
rbill = float(input("What is the total bill?"))
print("What was the level of service?")
service = input("Please choose amazing, okay, or horrible:")
while service = amazing:
tip=(bill*0.20)
total=(bill+tip)
print("The bill was $",bill)
print("The service was",service)
print("The tip is",tip)
print("The grand total with the tip is $",total)
–3月8日6:22
而不是代码中的while循环:
你应该用一个
^{pr2}$语句,当测试字符串值是否相等时,需要用引号将其设置为引号。在
下面的代码是你(Raj)在顶部链接的另一个帖子上的代码。我试图修改你的问题,但被拒绝了。在
下面的代码来自Raj的评论on his other post:
以下是我对这些问题所做的
–3月8日6:22
相关问题 更多 >
编程相关推荐