Leap year

Subject:
Insert picture description here
Insert picture description here
Insert picture description here
Code:

#!/bin/python3

import math
import os
import random
import re
import sys

# Complete the dayOfProgrammer function below.
def dayOfProgrammer(year):
    result = ''
    if year >= 1700 and year <=1917:
        if year % 4 == 0:
            result = "12.09.{res}".format(res=year)
            print(result)
        else:
            result = "13.09.{res}".format(res=year)
            print(result)
    
    if year == 1918:
        result = "26.09.{res}".format(res=year)        
    
    if year > 1918 and year <= 2700:
        if year % 400 == 0 or (year % 4 == 0 and year % 100 != 0):
            result = "12.09.{res}".format(res=year)
            print(result)
        else:
            result = "13.09.{res}".format(res=year)
            print(result)
    
    return result

if __name__ == '__main__':
    fptr = open(os.environ['OUTPUT_PATH'], 'w')

    year = int(input().strip())

    result = dayOfProgrammer(year)

    fptr.write(result + '\n')

    fptr.close()

If you feel good, please like and follow the message~
Thank you for joining us~

Guess you like

Origin blog.csdn.net/BSCHN123/article/details/113465149