Python Calendar Module Hackerrank Solution
Published November 2, 2023 by Jarvis Silva
Looking for the Hackerrank calendar challenge solution in Python? You are at the right place. In this article, I will share the python calendar hackerrank solution.
Hackerrank is a popular online platform which has many programming challenges and competitions which allows developers to participate into them and improve their programming skill.
Question
You are given a date. Your task is to find what the day is on that date.
You can find the full question of this problem here: Python Calendar Module Hackerrank Question.
In this challenge we need to find day of the week for example if date is 08-05-2015 then the output will be wednesday to create this program we will need to use the calendar module in python.
Before moving to the solution you should definately try to do this on your own it is very easy but still if you can’t solve it don’t worry you can check the below solution and understand this program.
Python Calendar Module Hackerrank Solution
from datetime import datetime
import calendar
date_str = input()
date = datetime.strptime(date_str, '%m %d %Y')
print ('{}'.format(calendar.day_name[date.weekday()]).upper())
Above is the python solution for calendar Hackerrank challenge, you can submit the above code in hackerrank and it should show you congratulations you solved this challenge.
So this was for this article, I hope you found what you were looking and if you want more hackerrank solutions then visit here: Hackerrank python solutions.
Thank you for reading, Happy coding 😊