We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • HackerRank Home

    HackerRank

  • |
  • Prepare
  • Certify
  • Compete
  • Apply
  • Hiring developers?
  1. Prepare
  2. Python
  3. Date and Time
  4. Calendar Module
  5. Discussions

Calendar Module

Problem
Submissions
Leaderboard
Discussions
Editorial

Sort 594 Discussions, By:

recency

Please Login in order to post a comment

  • erKarim
    4 days ago+ 0 comments
    # Enter your code here. Read input from STDIN. Print output to STDOUT
    import calendar
    import collections
    m, d, y = map(int, input().split())
    wd = collections.defaultdict(list)
    wd[0].append('Monday'.upper())
    wd[1].append('Tuesday'.upper())
    wd[2].append('Wednesday'.upper())
    wd[3].append('Thursday'.upper())
    wd[4].append('Friday'.upper())
    wd[5].append('Saturday'.upper())
    wd[6].append('Sunday'.upper())
    print(wd[calendar.weekday(y, m, d)][0])
    
    0|
    Permalink
  • anw_g01
    4 days ago+ 0 comments
    import calendar
    
    date = list(map(int, input().split()))
    day_of_week = calendar.weekday(date[2], date[0], date[1])
    
    days_dict = {
        0: "Monday",
        1: "Tuesday",
        2: "Wednesday",
        3: "Thursday",
        4: "Friday",
        5: "Saturday",
        6: "Sunday"
    }
    print(days_dict[day_of_week].upper())
    
    0|
    Permalink
  • ashley_yue117
    7 days ago+ 0 comments
    from calendar import weekday, day_name
    
    m, d, y = map(int, input().split())
    
    print(day_name[weekday(y, m, d)].upper())
    
    0|
    Permalink
  • nandini_lingired
    2 weeks ago+ 0 comments

    from datetime import datetime date=input().split() day=datetime(int(date[2]),int(date[0]),int(date[1])) print(day.strftime("%A").upper())

    0|
    Permalink
  • thainguyen2893
    2 weeks ago+ 0 comments
    import calendar
    month, day, year = list(map(int, input().split()))
    print(list(calendar.day_name)[calendar.weekday(year, month, day)].upper())
    
    0|
    Permalink
Load more conversations

Need Help?


View editorial
View top submissions
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy