forked from sumedha3111/Python-for-Beginners
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfirstdayofanyyear.py
More file actions
Latest commit
21 lines (16 loc) · 595 Bytes
/
Copy pathfirstdayofanyyear.py
File metadata and controls
21 lines (16 loc) · 595 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
defcheck_leap(year):
return (year%4==0and (year%100!=0oryear%400==0))
days=["monday","tuesday","wednesday","thursday","friday","saturday","sunday"]
defmain(year , dayg , yearc): #Enter the given year(int) , first day of given year(str) , the year whose first day is required(int)
n,diff=0,0
foriinrange(len(days)):
ifdayg.lower()==days[i]:
n=i
foriinrange(year,yearc):
ifcheck_leap(i):
diff+=2
else:
diff+=1
n+=diff%7
return(days[n%7])
print(main(2000,'saturday' , 3001))