in_time = input("in
xx.xx)")
out_time = input("out
xx.xx)")
def price(in_time,out_time):
in_hr = int(in_time[0:2])
in_mn = int(in_time[3:5])
out_hr = int(out_time[0:2])
out_mn = int(out_time[3:5])
total = (out_hr * 60 + out_mn) - (in_hr * 60 + in_mn)
if (total) % 60 == 0:
hr = total // 60
else:
hr = total //60+1
if 7<= in_hr <= 24 and 7<= out_hr<=24 and 0 <= in_mn <=60 and 0 <= out_mn <= 60:
if hr <=2:
print("total price : 0")
if 2 < hr <= 4:
print("total parking : {}".format((hr - 2) *20))
if hr > 4:
print("total parking price : {}".format((40 + (hr - 4)* 30))
print("total parking hours : {}".format(hr))
else
print("-----")
price(in_time, our_time)
ช่วยหน่อยนะค่ะผิดพลาดตรงไหนถึงไม่สามมารถรันได้
ช่วยแก้โปรแกรมpython
out_time = input("outxx.xx)")
def price(in_time,out_time):
in_hr = int(in_time[0:2])
in_mn = int(in_time[3:5])
out_hr = int(out_time[0:2])
out_mn = int(out_time[3:5])
total = (out_hr * 60 + out_mn) - (in_hr * 60 + in_mn)
if (total) % 60 == 0:
hr = total // 60
else:
hr = total //60+1
if 7<= in_hr <= 24 and 7<= out_hr<=24 and 0 <= in_mn <=60 and 0 <= out_mn <= 60:
if hr <=2:
print("total price : 0")
if 2 < hr <= 4:
print("total parking : {}".format((hr - 2) *20))
if hr > 4:
print("total parking price : {}".format((40 + (hr - 4)* 30))
print("total parking hours : {}".format(hr))
else
print("-----")
price(in_time, our_time)
ช่วยหน่อยนะค่ะผิดพลาดตรงไหนถึงไม่สามมารถรันได้