我想停止小数输入超过00.0(1dp)。 所以他们输入一个数字,但我希望它以1dp为百分比(例如44.7%或7.5%) 这是代码:
print(aCounter)
答案 0 :(得分:0)
while nameSave <=0 or nameSave >99:
while True:
try:
nameSave = float(input("Enter % Savings (Between 1-99%): "))
check = str(nameSave)
if (check[1] == '.' and len(check) > 3) or len(check) > 4:
print("Needs to be precise to 1 decimal point")
break
except:
print("Needs to be a number ")