วันอาทิตย์ที่ 20 กันยายน พ.ศ. 2558

Lab4x - Leafyear

def setup():
   print("Leap Year?\n")
   leapyear(1796)
   leapyear(2000)
   leapyear(1800)
   leapyear(2015)

def leapyear(year):
   if((year%4 == 0 and year%100 != 0) or (year%4 == 0 and year%100 == 0 and year%400 == 0)):
      print("'",year,"' is a leap year.")
   else:
      print("'",year,"' isn't a leap year.")
 
setup()

ไม่มีความคิดเห็น:

แสดงความคิดเห็น