if statement - Trying to Figure out how to properly use a while loop in Python 3.3.0 -


I am a real nio on Python and I'm writing a program that states that a given date is a valid calendar date or not . I'm sure this is a very elegant way to do it.

At this time I am trying to explain how I can add a variable to create a loop, which will take care of that date, if it is a leap year or not a leap year . All suggestions are very welcome.

In my area of ​​code efforts, I & lt; & Gt; has put. I still have the code:

  DIF (main): print ("This program tests the validity of a certain date") = date (input ("Please date (mm ( Day) year = int (year) My list 31 = [1, 3, 5, 7, 8, 10, 12] My index 30 = [4, 6, 9, 11] # Calculates whether the input year is a leap Whether the year or not, if year> = 100 and year% 4 == 0 and year% 400 == 0: & lt; it is a leap year & gt; Elif year> = 0 and year & lt; 100 and Year% 4 == 0: & lt; this is a leap year & gt; Else: & lt; it is not leapyear While I have this month in my listener and lieutenier: My list is 31 and in the day range (1, 32): print ("valid date") day in Elife month and range (1,31) in my list 30: Print ("valid date") alif month == 2 and day limit (1,30): print ("valid date") and: print ("no valid date") while & lt; this is a leapyear & gt; Etc ...   

main ()

I Hopefully there is a little bit of your code out there Area you will want to do what you want.

  DIF (main): Print ("This program tests the validity of a certain date") date = (raw_input ("Please" a date (mm / day / year): " )) Month, day, year = date.Sources ("/") month = int (months) day = int (day) year = int (year) my list 31 = [1, 3, 5, 7, 8, 10 , 12] My list 30 = [4, 6, 9, 11] ## calculates whether the input year is a leap year, if year> = 100 and year% 4 == 0 and year% 400 == 0: is_leap_year = True elif year> gt; = 0 and year> 100 and year% 4 == 0: is_leap_year = true Else: is_leap_year = is false if is_leap_year: if mylist 31 and day limit (1, 32) in the month: print ("valid date") in my list 30 and day limit (1,31) Elife month: print ("valid date ") Elif Months == 2 and Day Limit (1,30): Print (" Valid Date ") Other: Print (" Not a valid date ") and: #TODO: Do not validate - Pass Leap-year date. ()    

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -