Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions challenges/week_1/bus_fare_challenge.py
Original file line number Diff line number Diff line change
@@ -1 +1,21 @@
# WRITE YOUR CODE SOLUTION HERE
from datetime import date

today = date.today()

# dd/mm/YY
d1 = today.strftime("%d/%m/%Y")
print("d1 =", d1)
# the week for a given date
import calendar

def findDay(date):
day, month, year = (int(i) for i in date.split(' '))
dayNumber = calendar.weekday(year, month, day)
days =["Monday", "Tuesday", "Wednesday", "Thursday",
"Friday", "Saturday", "Sunday"]
return (days[dayNumber])

# Driver program
date = '01 02 2021'
print(findDay(date))