Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

next day in python without using datetime

import datetime                                 
from datetime import timedelta                  
                                                
d = int(input('enter the day: '))               
m = int(input('enter the month: '))             
y = int(input('enter the year: '))              
                                                
today = datetime.date(y, m, d)                  
tom = today + timedelta(days=1)                 
print('next day is', tom)                       
Comment

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)
Comment

PREVIOUS NEXT
Code Example
Python :: pygame.set_volume(2.0) max volume 
Python :: display result in same page using flask api 
Python :: tuple in godot 
Python :: random choice without replacement python 
Python :: pandas to tensor torch 
Python :: python define 2d table 
Python :: python delete header row 
Python :: create temporary files in python 
Python :: how to read a .exe file in python 
Python :: matplotlib show percentage y axis 
Python :: linux command on python 
Python :: generate number of n bits python 
Python :: convert categorical data type to int in pandas 
Python :: python read mp3 livestream 
Python :: pythom datetime now 
Python :: pandas dataframe print decimal places 
Python :: Get Key From value in dictionary 
Python :: how to record pyttsx3 file using python 
Python :: python version check 
Python :: uninstall poetry 
Python :: median in python 
Python :: python dictionary dot product 
Python :: how to install python 2 
Python :: check django version 
Python :: how to slicing dataframe using two conditions 
Python :: cprofile usage python 
Python :: django queryset unique values 
Python :: pyperclip copy paste 
Python :: print python 
Python :: sort list of dictionaries python 
ADD CONTENT
Topic
Content
Source link
Name
8+7 =