Find the black Friday of the input year:
Usage:
1 #-*-coding:utf-8-*-2 3 #python programming job, find black Friday4 5Theyear = input ("want to Konw:")6 7Thefirstday = input ("What day is Thefirstday (1, 2, 3, 4, 5, 6, 7):")8 9Day = 1#Days Count VariableTen OneBigmonth = [1, 3, 5, 7, 8, 10, 12] ASmallmonth = [4, 6, 9, 11] - - if((theyear% 4 = = 0) and(theyear% 100 = 0))or(theyear% 400 = =0): the PrintU"This is a leap year, February 29th" - - forThemonthinchRange (1, 13) : - ifThemonthinchBigmonth: + forThedayinchRange (1, 32) : - if(Theday = = 13) and(Day% 7 = = 5) : + Print "The day is Black Friday:%d/%d/%d"%(Theyear, Themonth, Theday) ADay = day + 1#each round of the day will count the number of days variable plus one at elifThemonthinchSmallmonth: - forThedayinchRange (1, 31) : - if(Theday = = 13) and(Day% 7 = = 5) : - Print "The day is Black Friday:%d/%d/%d"%(Theyear, Themonth, Theday) -Day = day + 1#each round of the day will count the number of days variable plus one - Else : in forThedayinchRange (1, 30) : - if(Theday = = 13) and(Day% 7 = = 5) : to Print "The day is Black Friday:%d/%d/%d"%(Theyear, Themonth, Theday) +Day = day + 1#each round of the day will count the number of days variable plus one - the Else : * PrintU"This is common year, February. 28th" $ Panax Notoginseng forThemonthinchRange (1, 13) : - ifThemonthinchBigmonth: the forThedayinchRange (1, 32) : + if(Theday = = 13) and(Day% 7 = = 5) : A Print "The day is Black Friday:%d/%d/%d"%(Theyear, Themonth, Theday) theDay = day + 1#each round of the day will count the number of days variable plus one + elifThemonthinchSmallmonth: - forThedayinchRange (1, 31) : $ if(Theday = = 13) and(Day% 7 = = 5) : $ Print "The day is Black Friday:%d/%d/%d"%(Theyear, Themonth, Theday) -Day = day + 1#each round of the day will count the number of days variable plus one - Else : the forThedayinchRange (1, 29) : - if(Theday = = 13) and(Day% 7 = = 5) :Wuyi Print "The day is Black Friday:%d/%d/%d"%(Theyear, Themonth, Theday) theDay = day + 1#each round of the day will count the number of days variable plus one
Python-based Black Friday find script