Date validator program always showing false result any ideas? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Date validator program always showing false result any ideas?

I wrote this script to validate date and it is always showing false even with the correct dates can anybody suggest what's wrong here? https://code.sololearn.com/cSLzUovRv2Vn/?ref=app

8th Dec 2019, 5:09 PM
Azmat
2 Answers
+ 5
def year_check(dd,mm,yyyy): if yyyy > 2156 or yyyy < 0: return True else: return False -logical error: replace 'False' and 'True' with each other to correct it. -what when day is 31 ? you didn't looked into case for it ? -what about different months having different mumbers of days? if you made for leap year and february, you can easily make it for rest of the months(use array for simplicity).
8th Dec 2019, 7:58 PM
Gaurav Agrawal
Gaurav Agrawal - avatar
9th Dec 2019, 1:34 AM
Azmat