0
내 목표는 입력 (Battery_Capacity)을 받아 궁극적으로 최대 용량 인 80에 도달하는 데 필요한 (New_Battery_Capacity) 및 (Cycle) 목록을 궁극적으로 뱉어내는 프로그램을 만드는 것입니다.범위 기능 사용
Cycle = range (160)
Charger_Rate = 0.5 * Cycle
Battery_Capacity = float(raw_input("Enter Current Capacity:"))
New_Battery_Capacity = Battery_Capacity + Charger_Rate
if Battery_Capacity < 0:
print 'Battery Reading Malfunction (Negative Reading)'
elif Battery_Capacity > 80:
print 'Battery Reading Malfunction (Overcharged)'
elif float(Battery_Capacity) % 0.5 !=0:
print 'Battery Malfunction (Charges Only 0.5 Interval)'
while Battery_Capacity >= 0 and Battery_Capacity < 80:
print New_Battery_Capacity
제 Cycle = range (160)이 내 프로그램에서 작동하지 않는 이유가 궁금합니다.
해결되지 않은 것은 무엇입니까? – kindall
어떻게 작동하지 않습니까? 'Cycle '을'range (160) '에 지정한 후에는 아무 것도하지 않는 것처럼 보입니다. –
처음에는'Cycle'에 값을주기 전에'Charger_Rate = 0.5 * Cycle'에서'Cycle'을 사용합니다. –