如何允许某人输入值前带有“$”的浮点整数。例如,他们可以输入“$4.25”,也可以输入“4.25”。
此外,当我在计算器中输入“4.35”时,提示显示为“0.6”。在我家里拥有的计算器上,它显示为 0.6525。我如何得到完整的答案?
input ('Please Enter to begin')
while True:
print('This calculator will display the tip you owe for your meal price.')
mealPrice = int(float(input('Enter your meal price:')))
asw = mealPrice * 0.15
print('The tip you owe is: $',asw)
endProgram = input ('Do you want to restart the program?')
if endProgram in ('no', 'No', 'NO', 'false', 'False', 'FALSE'):
break