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
|
4511 Discussions
|
Please Login in order to post a comment
Why it Wrong?? x = int(input()) if x % 2 == 1: print('Weird') else: if x in range(2,5): print('Not Weird') elif x in range(6,20): print("Weird") else: print('Not Weird')
n = int(input())
if n%2==1 or n>=6 and n<=20: print("Weird") else: print("Not Weird")
n = 30 if not n % 2 == 0: print("Weird") 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 20 < n: print("Not Weird") Why does the website show false?
if name == 'main': n = int(input().strip()) if n%2!=0: print("Weird") elif n%2==0 and range(2,6): print("Not Weird") elif n%2==0 and range(6,21): print("Weird") elif n%2==0 and n>20: print("Not Weird")