Python-based Black Friday find script

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.