GOEDUHUB Tutorials    ||    AI    ||    ML  ||    NLP    ||    OpenCV    ||    Python    ||    OOPS    ||    DBMS    ||    DSA    ||    JAVA    ||    Linux    ||    C Programming
7976731765 Go To Your University       ||       Placement Preparation       ||        Technical-MCQ and Interview Questions
Online Live Classes Youtube Live Link
0 like 0 dislike
2.2k views
in Python Programming by Goeduhub's Expert (8.1k points)
Expected Output:

Input a year: 2019                                                      

Input a month [1-12]: 08                                                

Input a day [1-31]: 23                                                  

The next date is [yyyy-mm-dd] 2019-8-24

1 Answer

0 like 0 dislike
by Goeduhub's Expert (8.1k points)
 
Best answer
d=int(input("ENTER THE DAY : "))

m=int(input("ENTER THE MONTH : "))

y=int(input("ENTER THE YEAR : "))

 

if ((y % 4 == 0) and (y % 100!= 0)) or (y%400 == 0):

    if m==2:

        d1=29

    elif m==1 or m==3 or m==5 or m==7 or m==8 or m==10 or m==12:

        d1=31

    else :

        d1=30

else:

    if m==2:

        d1=28

    elif m==1 or m==3 or m==5 or m==7 or m==8 or m==10 or m==12:

        d1=31

    else :

        d1=30

if d==31 and m==12 :

    d=1

    m=1

    y=y+1   

elif d1-d==0 :

    m=m+1

    d=1

else:

    d=d+1

    

print("NEXT DAY IS : ",d,"/",m,"/",y)

 Goeduhub:

About Us | Contact Us || Terms & Conditions | Privacy Policy || Youtube Channel || Telegram Channel © goeduhub.com Social::   |  | 
 Placements:   List of companies | Logical Reasoning Questions | Quantitative Aptitude Questions | General English Questions | Technical-MCQ and Interview Questions
 Important Lists: List of NITsList of IITsList of Exams After Graduation | List of Engineering Entrance Examinations (UG/PG)College ReviewsCollege Fest, Events & WorkshopsKnowledge ShareTrainees/Interns After 15-04-2020
Exams & Cutoffs: JEE Main | JEE Advanced | GATE | IES | ISROList of PSUs || Cutoff-GATECutoff_IIT-JEECS-ScopeECE ScopeEE-Scope
 Download Previous Year Papers For:  GATE | IES | RAJASTHAN TECHNICAL UNIVERSITY (RTU-Kota)RPSC Technical Exams | ISRO
...