我为此感到抱歉,但我是一个完全的初学者,无论我尝试什么,它都会出错。任何人都可以给我一个小小的想法,我的elif声明出了什么问题,所以我可以坚持下去吗? (我也知道目前0%的错误为1%,只是测试理论)
one = (1)
three = (2)
four = (4)
five = (5)
seven = (7)
stampduty = int(input("Enter amount of residential property"))
if stampduty >= 1 and stampduty<=125000:
add = (stampduty*one/100.0)
addamount = stampduty + add
print("Stamp Duty percent 0% \nyour stamp duty amount is", addamount)
elif:
add = add = (stampduty*one/100.0)
addamount = stampduty + add
print("Stamp Duty percent 0% \nyour stamp duty amount is", addamount)
答案 0 :(得分:7)
elif
需要一个条件,就像if
语句一样。如果您想要无条件阻止,请使用else
:
if stampduty >= 1 and stampduty<=125000:
add = (stampduty*one/100.0)
addamount = stampduty + add
print("Stamp Duty percent 0% \nyour stamp duty amount is", addamount)
else:
add = add = (stampduty*one/100.0)
addamount = stampduty + add
print("Stamp Duty percent 0% \nyour stamp duty amount is", addamount)
答案 1 :(得分:0)
也许您应该使用else
代替elif
。
在elif
中,与if
中一样,您需要传递条件。