1
一些帮助,这是我的Python代码来计算电费需要对Python代码
cust=input("Enter Customer Number\n");
units=input("Enter No of Units\n");
if(units<200&units>0):
bill=0.50*units;
elif(units>200&units<400):
bill=100+(0.65*(units-200))
print"\n in Loop2\n"
elif(units>400&units<600):
bill=230+(0.80*(units-400))
print"\n in Loop3\n"
print"Bill For Customer Number ",cust," is ",bill
如果我给单位200多家是在环2 但是,如果我给单位430它是在仍然运行环2
我新的Python所以需要一些帮助
你可以使用这个语法:'如果0 <单位<200:'... – PRMoureu
考虑强制单位'int':'单位= INT(单位)' – snakecharmerb
谢谢snakecharmerb – user3123757