if, else the practice record - to determine the number of days in May

1 m = int (the INPUT ( " Please enter the month " ))
 2  IF m in (1,3,5,7,8,10,12 ):
 3      Print ( " annual " + str (m) + " to month is 31 days " )
 . 4  the else :
 . 5      IF m in (4,6,9,11 ):
 . 6          Print ( " annual " + STR (m) + " month is 30 days " )
 . 7      the else :
 . 8          Y = int ((the iNPUT " enter the year "))
 . 9          IF Y == 400% 0:
 10              Print (STR (Y) + " in " + STR (m) + " month with 29 days " )
 . 11          the else :
 12 is              IF Y == 0. 4% and Y% 100 =! 0:
 13 is                  Print (STR (Y) + " in " + STR (m) + " month with 29 days " )
 14              the else :
 15                  Print (STR (Y) + " in " + STR (m) + " May there are 28 days " )

If the month entered for February, then asked to enter the year and determine whether it is a leap year, return 28 or 29 days

 

Leap year two cases:

  1, is divisible by four, but can not be divisible 100

  2, may be divisible 400

Guess you like

Origin www.cnblogs.com/penn666/p/12054051.html
Recommended