Sort by

recency

|

686 Discussions

|

  • + 0 comments
    import calendar
    
    M,D,Y = map(int,input().split())
    
    print(calendar.day_name[calendar.weekday(Y,M,D)].upper())
    
  • + 0 comments

    Maybe my solution could inspire someone :

    I have noticed with print() that weekday() return a number corresponding to the day in a week. (Monday = 0, Tuesday = 1, Wednesday = 2 ... Sunday = 6).

    So I have created a dictionnary and use it with the function calendar.weekday() to return the good day name :

    import calendar
    
    date = list(map(int, input().split()))
    
    days = {
        0: "MONDAY",
        1: "TUESDAY",
        2: "WEDNESDAY",
        3: "THURSDAY",
        4: "FRIDAY",
        5: "SATURDAY",
        6: "SUNDAY"
    }
    
    day_in_week = calendar.weekday(date[2], date[0], date[1])
    print(days[day_in_week])
    
  • + 0 comments
    import calendar
    
    month,day,year=map(int,input().split())
    
    weekday_index = calendar.weekday(year,month,day)
    
    weekday_name =calendar.day_name[weekday_index]
    
    print(weekday_name.upper())
    
  • + 0 comments

    arr = input().split()

    month = int(arr[0]) date = int(arr[1]) year = int(arr[2])

    weeddayidx = calendar.weekday(year, month, date) print(calendar.day_name[weeddayidx].upper())

  • + 0 comments
    # I googled calendar module and found the .weekday() method. The rest of the solution is easy.
    import calendar
    
    month, day, year = input().split()
    weekday = calendar.weekday(int(year), int(month), int(day))
    week = ["MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY", "SATURDAY", "SUNDAY"]
    print(week[weekday])