from datetime import date,time
import calendar
now = date.today()
start_time = input("Enter the start time: ".format("%H:%M"))
end_time = input("Enter the end time: ".format("%H:%M"))
def timeline(start_time,end_time):
current_time = now.strftime("%H:%M")
>*to display all time in sunday as full-over time*
for calendar.SUNDAY in current_time:
if start_time == time(0, 0) and end_time == time(23, 59): return "Full-over time in Sundays"
>*to split and display time interval in saturdays*
for calendar.SATURDAY in current_time:
if start_time >= time(8, 00) and end_time <= time(11, 59): return "Half-Over time in saturdays"
else: return "Full-over time in Saturdays"
>*to split and display time interval in weekdays for example in Monday*
for calendar.MONDAY in current_time:
if start_time >= time(8,00) and end_time <= time(15,59): return "Normal weekday hour"
elif start_time >= time(16,00) and end_time <= time(20,59): return "Half-Over weekday"
else: return "Full-Over weekday"
return current_time
print(timeline)
代码未执行,我将非常感谢您提供的有关解决此代码或进行任何更改的帮助