0% found this document useful (0 votes)
17 views7 pages

The Laboratory Work 9

Python lab work

Uploaded by

lloooos
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views7 pages

The Laboratory Work 9

Python lab work

Uploaded by

lloooos
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

The laboratory work 9

Exercise 1: Print current date and time in Python


Solution:

Exercise 2: Convert string into a datetime object

For example, you received the following date in string format. Please convert it into
Python’s datetime object.

Solution:
Exercise 3: Subtract a week (7 days) from a given date in Python

Given:

Exercise 4: Print a date in the following format


Solution:

Exercise 5: Find the day of the week of a given date

Solution:

Exercise 6: Add a week (7 days) and 12 hours to a given date


Solution:

Exercise 7: Print current time in milliseconds


Exercise 8: Convert the following datetime into a string

Solution:

Exercise 9: Calculate the date 4 months from the current date

Expected output:

Solution:
Exercise 10: Calculate number of days between two given dates

Solution:

You might also like