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.
- Prepare
- Python
- Introduction
- Python If-Else
- Discussions
Python If-Else
Python If-Else
Sort by
recency
|
4460 Discussions
|
Please Login in order to post a comment
n = 7 if n % 2==1: print ("weired") elif n % 2 == 0 and 2 <= n <=5: print ("not weired")
elif n % 2 == 0 and 6 <= n <=20: print ("weired") elif n % 2 == 0 and n > 20: print ("not weired") whats wrong with this code
Check out my code:
if name == 'main': n = int(input().strip()) o_e = n%2 if( not o_e and (2<=n<=5 or n>20)): print("Not Weird") elif( o_e or ( not o_e and 6<=n<=20)): print("Weird")
n = int(input('Enter the number: '))
if n % 2 != 0: print('Weird')
elif 2 <= n <= 5 : print('not Weird')
elif 6 <= n <= 20: print('Weird')
else: print('NOT Weird')
n = int(input("Enter the number: "))
if n % 2 != 0: print("Weird") elif 2 <= n <= 5: print("Not Weird") elif 6 <= n <= 20: print("Weirdn = int(input("enter the number:")) if n % 2 == 0: if n in range(2,6): print("Not Weird"); elif n in range(6,21): print("Weird"); elif n > 20: print("Not Weird"); whats wrong on my code .
else: print("Weird") else: print("Not Weird")