Day of the Week
In Python, we have a built-in module called datetime that allows us to create, manipulate, and work with dates and times. This problem can be solved by creating a datetime object with the given day, month, and year, and then using the strftime function to format the date object to the day of the week.
Here’s the Python solution:
|
|
The strftime function takes one parameter, a format string, and returns a string representing the date. “%A” is a directive that gets replaced by the full weekday name. The other directives you can use with strftime can be found in Python’s official documentation.