- 2
If - else
a = int(input()) a1 = a>20 if a%2==0 and not a%3==0 or a%24==0: print("Not Weird") elif a1 == True and a1/2==0: print("Not Weird") else: print("Weird") Here is my code please check this code on the link down below! https://www.hackerrank.com/challenges/py-if-else/problem
1 Resposta
+ 1
I don't get your solution at all, according to me question is simply asking this .
n=int(input())
if n%2!=0:
print("Weird")
elif n%2==0 and n in range(2,6):
print("Not Weird")
elif n%2==0 and n in range(6,21):
print("Weird")
elif n%2==0 and n>20:
print("Not Weird")
And on a thought you wudn't need to check the even number if odd is already caught in the first if!