python休假管理_Python计算休假日从一个轮班工施

import datetime

sched1 = {'Mon':'working','Tues':'working','Wed':'off','Thur':'working','Fri':'working','Sat':'working','Sun':'off'}

sched2 = {'Mon':'off','Tues':'working','Wed':'working','Thur':'working','Fri':'working','Sat':'off','Sun':'working'}

pickdate1 = int(input("Enter a date in the year (YYYY)): "))

pickdate2 = int(input("Enter a date in the year (MM): "))

pickdate3 = int(input("Enter a date in the year (DD): "))

date = datetime.date(pickdate1,pickdate2,pickdate3)

weekno = datetime.date(pickdate1,pickdate2,pickdate3).isocalendar()[1]

weekday = datetime.date.isoweekday(date)

if weekno % 2 == 0:

if weekday == 1:

print ("You are: %s" % (sched2['Mon']))

elif weekday == 2:

print ("You are: %s" % (sched2['Tues']))

elif weekday == 3:

print ("You are: %s" % (sched2['Wed']))

elif weekday == 4:

print ("You are: %s" % (sched2['Thur']))

elif weekday == 5:

print ("You are: %s" % (sched2['Fri']))

elif weekday == 6:

print ("You are: %s" % (sched2['Sat']))

elif weekday == 7:

print ("You are: %s" % (sched2['Sun']))

elif weekno % 2 != 0:

if weekday == 1:

print ("You are: %s" % (sched1['Mon']))

elif weekday == 2:

print ("You are: %s" % (sched1['Tues']))

elif weekday == 3:

print ("You are: %s" % (sched1['Wed']))

elif weekday == 4:

print ("You are: %s" % (sched1['Thur']))

elif weekday == 5:

print ("You are: %s" % (sched1['Fri']))

elif weekday == 6:

print ("You are: %s" % (sched1['Sat']))

elif weekday == 7:

print ("You are: %s" % (sched1['Sun']))

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值