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
|
4529 Discussions
|
Please Login in order to post a comment
n=int(input('enetr a number')) if n%2!=0: print('Wierd') elif n%2==0 and 2<=n<=5: print('Not Weird') elif n%2==0 and 6<=n<=20: print('weird') elif n%2==0 and n>20: print('Not Weird') else: print('invalid input')
def evod(n): if n%2!=0: print("Weird") count=1 while count<=100: if n%2==0 and n<=5: print("Not Weird") break elif n%2==0 and n>=6 and n<=20: print("Weird") break elif n%2==0 and n>=20: print("Not Weird") break else: pass evod(20) May i know why odd conditon is failed in my case
n = int(input()) if 6<=n<=20 and n % 2 == 0: print('Weird') elif n%2 == 0: print('Not Weird') else: print('Weird')
n = int(input()) if n%2 != 0: print('Wierd') elif n>1 and n<6: print('Not Wierd') elif n>5 and n<21: print('Wierd') elif n>20: print('Not Wierd') Any idea why this is wrong
n = int(input()) if n % 2 !=0: print("Weird") elif n<=5: print("Not Weird") elif n<=20: print("Weird") else: print("Not Weird")