filmov
tv
Python program to validate a date given month day and year in Hindi

Показать описание
Python program to validate date given day, month and year.
Python program to validate date given dd, mm and yyyy.
Example 1:
Input:
dd = 29 mm=2 yyyy=2020
Output:
Valid
Example 2:
Input:
dd = 31 mm=6 yyyy=2020
Output:
Invalid
Python practice program for CBSE class 11 & class 12 computer science students in Hindi.
Python tutorial in Hindi for CBSE class XI & class XII computer science students.
Python practice program for beginners.
Python practice program in integers.
Python practice program in loops.
Python practice program in dates.
0:00 Intro & Problem description
0:46 Python code to validate date given day, month and year.
6:29 Testing the python code to validate date given day, month and year.
Question : Why are 1700, 1800 & 1900 not leap years but 2000 is?
Answer:
The number of days in a year are 365.2425, which is a little less than 365.25
Therefore, the correct number of days in 400 years = 365.2425*400 = 146097 days
Number of days with only the 4 year condition = 365.25*400 = 146100 [Number of days if the length of year was 365.25 and not 365.2425]
Difference = 3 (=146100-146097) days which we have overcompensated
Now, we have 400 years in which we have to remove 3 days: so 1700 not a leap year, 1800 not a leap year, 1900 not leap year but 2000 is a leap year
Total 3 days saved
And three 100th years between 400 year gap (ex: 1700,1800 & 1900 between 1600 and 2000) are chosen so that the calendar & seasons stay aligned to the earths natural orbit.
Python program to validate date given dd, mm and yyyy.
Example 1:
Input:
dd = 29 mm=2 yyyy=2020
Output:
Valid
Example 2:
Input:
dd = 31 mm=6 yyyy=2020
Output:
Invalid
Python practice program for CBSE class 11 & class 12 computer science students in Hindi.
Python tutorial in Hindi for CBSE class XI & class XII computer science students.
Python practice program for beginners.
Python practice program in integers.
Python practice program in loops.
Python practice program in dates.
0:00 Intro & Problem description
0:46 Python code to validate date given day, month and year.
6:29 Testing the python code to validate date given day, month and year.
Question : Why are 1700, 1800 & 1900 not leap years but 2000 is?
Answer:
The number of days in a year are 365.2425, which is a little less than 365.25
Therefore, the correct number of days in 400 years = 365.2425*400 = 146097 days
Number of days with only the 4 year condition = 365.25*400 = 146100 [Number of days if the length of year was 365.25 and not 365.2425]
Difference = 3 (=146100-146097) days which we have overcompensated
Now, we have 400 years in which we have to remove 3 days: so 1700 not a leap year, 1800 not a leap year, 1900 not leap year but 2000 is a leap year
Total 3 days saved
And three 100th years between 400 year gap (ex: 1700,1800 & 1900 between 1600 and 2000) are chosen so that the calendar & seasons stay aligned to the earths natural orbit.