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
|
4017 Discussions
|
Please Login in order to post a comment
I'm sharing my functional solution if anyone needs it. Its a lil convoluted but I thought if statements would be too boring so I did this:
the code is : n = int(input()) if (n%2) != 0: print("Weird")
elif (n%2) == 0: if n in range(2,5): print("Not Weird") if n in range(6,20): print("Weird")
if (n%2) == 0 and n > 20: print("Not Weird") if n == 20: print("Weird")
Given an integer, , perform the following conditional actions:
If is odd, print Weird If is even and in the inclusive range of to , print Not Weird If is even and in the inclusive range of to , print Weird If is even and greater than , print Not Weird
i don't know how to solve this problem Task Given an integer, , perform the following conditional actions:
If is odd, print Weird If is even and in the inclusive range of to , print Not Weird If is even and in the inclusive range of to , print Weird If is even and greater than , print Not Weird Input Format
A single line containing a positive integer, .
Constraints
Output Format