i am doing a challenge but for some reason every time i run it says 3 outta of 7 test cases are incorrect and don't know why? everything seems in order. Here is the challenge if Task Given an integer, , perform the following conditional actions:
If is odd, print Weird If is even and in the inclusive 2 range of 5 to , print Not Weird If is even and in the inclusive range of 6 to 20, print Weird If is even and greater than 20, print Not Weird
My code below:
n = int(input().strip())
if n % 2 != 0:
print("Weird")
else:
if n % 2 == 1 and n in range(2,5):
print("Not Weird")
elif n % 2 == 1 and n in range(6,20):
print("Weird")
elif n > 20:
print("Not Weird")
Aucun commentaire:
Enregistrer un commentaire