Amazing technological breakthrough possible @S-Logix pro@slogix.in

Office Address

  • #5, First Floor, 4th Street Dr. Subbarayan Nagar Kodambakkam, Chennai-600 024 Landmark : Samiyar Madam
  • pro@slogix.in
  • +91- 81240 01111

Social List

Simple program for date validation and increment using python looping?

Description

To validate and increment the date using python3.

Process

  Print help.

   Print list.

   Add the items in to list.

   Print the items in the list.

   Quit the program.

Sample Code

#get input from the user
date=input(“Enter the date: “)

#split the input
dd,mm,yy=date.split(‘/’)
dd=int(dd)
mm=int(mm)
yy=int(yy)

#define the conditions

if(mm==1 or mm==3 or mm==5 or mm==7 or mm==8 or mm==10 or mm==12):
max1=31
elif(mm==4 or mm==6 or mm==9 or mm==11):
max1=30
elif(yy%4==0 and yy%100!=0 or yy%400==0):
max1=29
else:
max1=28
if(mm12):
print(“Date is invalid.”)
elif(ddmax1):
print(“Date is invalid.”)
elif(dd==max1 and mm!=12):
dd=1
mm=mm+1
print(“The incremented date is: “,dd,mm,yy)
elif(dd==31 and mm==12):
dd=1
mm=1
yy=yy+1
print(“The incremented date is: “,dd,mm,yy)
else:
dd=dd+1
print(“The incremented date is: “,dd,mm,yy)

Screenshots
Simple program for date validation and increment using python looping To validate and increment the date using python3 get input from the user