Welcome to collectivesolver - Programming & Software Q&A. A website you can trust. All programs tested and works. Contact: aviboots(AT)netvision.net.il
Web Hosting

Bonsai Boy of New York Bonsai Trees and Accessories

BlueHost Web Hosting

Liquid Web iThemes WordPress Hosting

Ecommerce Software - Best Ecommerce Platform Made for You - Free Trial

DreamHost Web Hosting


getResponse autofunnels

Liquid Web Cloud VPS Hosting

11,159 questions

15,235 answers

573 users

How make calculation with timedelta in Python

2 Answers

0 votes
import datetime
 
td = datetime.timedelta(days=1)     
print('1 day:', td)     
print('7 days:', td * 7)     
print('3.5 days:', td * 3.5)     
print('1/3 day:', td / 3)




'''
run:

1 day: 1 day, 0:00:00
7 days: 7 days, 0:00:00
3.5 days: 3 days, 12:00:00
1/3 day: 8:00:00

'''

 




answered Jun 6 by avibootz
0 votes
import datetime
 
work_time = datetime.timedelta(hours=9)     
project_time = datetime.timedelta(hours=2.5)     

print(work_time / project_time)



'''
run:

3.6

'''

 




answered Jun 6 by avibootz
...