In python, please use a function to implement a program that determines whether the year entered by the user is a leap year

hint:

1. Years divisible by 400

2. Years that are divisible by 4 but not divisible by 100

One of the above two methods is a leap year

def fun():
	year = int(input("As long as you enter a year I can tell you if it is a leap year:"))

	if (year%400 == 0) or (year%4==0 and year%100 != 0):
	    print("The year you entered [%d] is a run year"%year)

	else:
	    print("The year you entered [%d] is not a run year"%year)


fun()

	    

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327060482&siteId=291194637