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. Tutorials
  3. 30 Days of Code
  4. Day 3: Intro to Conditional Statements
  5. Discussions

Day 3: Intro to Conditional Statements

Problem
Submissions
Leaderboard
Discussions
Editorial
Tutorial

Sort 1699 Discussions, By:

recency

Please Login in order to post a comment

  • yadavakhilesh951
    16 hours ago+ 0 comments

    In python language

    #!/bin/python3
    
    import math
    import os
    import random
    import re
    import sys
    
    
    
    if __name__ == '__main__':
        N = int(input().strip())
        if N%2!=0:
            print("Weird")
        elif(N%2==0 and N>=2 and N<=5):
            print("Not Weird")
        elif(N%2 == 0 and N >= 6 and N <= 20):
            print("Weird")
        else:
            print("Not Weird")
        
    
    0|
    Permalink
  • kelony05
    3 days ago+ 0 comments

    python

    if name == 'main': N = int(input().strip())

    if N % 2 != 0: print("Weird") elif N % 2 == 0: if N >= 2 and N <= 5: print('Not Weird') elif N >= 6 and N <= 20: print('Weird') elif N > 20: print("Not Weird") else: print("Weird")

    0|
    Permalink
  • erginsanem
    5 days ago+ 0 comments
    function main() { const N = parseInt(readLine().trim(), 10);
    if (N % 2 != 0 && N >= 0){
        console.log("Weird")
    }else if (N >= 2 && N <= 5){
        console.log("Not Weird")
    }else if(N >= 6 && N <= 20){
        console.log("Weird")
    }else{
        console.log("Not Weird")
    }
    }
    
    0|
    Permalink
  • alphaallan
    3 weeks ago+ 0 comments

    function main() { const N = parseInt(readLine().trim(), 10);

    if (N % 2 != 0 && N >= 0){
        console.log("Weird")
    }else if (N >= 2 && N <= 5){
        console.log("Not Weird")
    }else if(N >= 6 && N <= 20){
        console.log("Weird")
    }else{
        console.log("Not Weird")
    }
    

    }

    0|
    Permalink
  • dokopang
    3 weeks ago+ 0 comments
    #!/bin/python3
    
    if __name__ == '__main__':
        n = int(input().strip())
    
        # Checks if the number is odd or if it is even and between 6 and 20, inclusive. 
        is_odd = (n % 2 != 0)
        is_inclusive_range = (6 <= n <= 20)
    
        # Print "Weird" when 'weird' conditional is True. Otherwise, it sets it to "Not Weird".
        weird_status = "Weird" if (is_odd or is_inclusive_range) else "Not Weird"
        print(weird_status)
    
    0|
    Permalink
Load more conversations

Need Help?


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