Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

next day in python

date = int(input('enter the date: '))
month = int(input('enter the month: '))
year = int(input('enter the year: '))

x = (1, 3, 5, 7, 10)
y = (4, 6, 8, 9, 11)
if month in x and date == 31:
    month = month + 1
    date = 1

elif month in x and date < 31:
    date = date + 1

elif month in y and date == 30:
    month = month + 1
    date = 1

elif month in y and date < 31:
    date = date + 1

elif month == 2 and date == 28 or date == 29:
    month = month+1
    date = 1

elif month == 2 and date < 29:
    date = date+1

elif month == 12 and date < 31:
    date = date + 1

elif month == 12 and date == 31:
    month = 1
    date = 1
    year = year + 1

print('%02d-' % date, '%02d-' % month, '%02d' % year)
 
PREVIOUS NEXT
Tagged: #day #python
ADD COMMENT
Topic
Name
8+1 =