Skip to content

Commit

Permalink
Create Day 11.py
Browse files Browse the repository at this point in the history
  • Loading branch information
GJAnsah authored Mar 4, 2019
1 parent a48b183 commit 71ce60c
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions Day 11.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
'''
HackerRank Conditionals (Day 3 of 30 days of code)
Task
Given an integer, n , perform the following conditional actions:
If n is odd, print Weird
If n is even and in the inclusive range of 2 to 5, print Not Weird
If n is even and in the inclusive range of 6 to 20, print Weird
If n is even and greater than 20, print Not Weird
Complete the stub code provided in your editor to print whether or not is weird.
'''

def wierd_or_not(N):

if N%2==1: #check if n is odd
return ("Weird")
else:
if ((N>=2) & (N<=5))|(N>20): #check if n is an even number between 2 and 5 inclusive, or above 20
return("Not Weird")
else:
return("Weird")

N = int(input())
print(wierd_or_not(N))

0 comments on commit 71ce60c

Please sign in to comment.