+ 2
if i input 6 it give weird and if i input 20 it give not weird .why it include 6 in 1st case not 20 in another case
n = int(input()) if(n%2!=0): print("Weird") else: if n in range(1,6): print("Not Weird") elif n in range(7,20): print("Weird") else: print("Not Weird")
4 Respuestas
+ 12
n = int(input())
if(n%2!=0):
#for odd
print("Weird1")
else:
if n in range(1,6):
#1,2,3,4,5
print("Not Weird1")
elif n in range(7,20):
#7,8,9,10,...19
print("Weird2")
else:
print("Not Weird2") #👉for 6,20
#so output will be "Now Weird2" for both 6,20
+ 9
☺
//welcome 👍
+ 1
thank u bhai
+ 1
range(1,6) starts from 1 to 5
range(7, 20) starts from 7 to 19
so 6 and 20 trigger the else part of the code print("Not Weird")