w3resource

Python: Find the date of the first Monday of a given week

Python Datetime: Exercise-14 with Solution

Write a Python program to find the date of the first Monday of a given week.

Sample Solution:

Python Code:

import time
print(time.asctime(time.strptime('2015 50 1', '%Y %W %w')))

Sample Output:

Mon Dec 14 00:00:00 2015  

Flowchart:

Flowchart: Find the date of the first Monday of a given week.

Python Code Editor:

Contribute your code and comments through Disqus.

Previous: Write a Python program to get week number.
Next: Write a Python program to select all the Sundays of a specified year.

What is the difficulty level of this exercise?

Test your Python skills with w3resource's quiz



Python: Tips of the Day

Free up Memory:

  • Manual garbage collection can be performed on timely or event based mechanism.
import gc
collected_objects = gc.collect()