0
what if I have more than 1 condition to satisfy and get the output same for all the conditions.
.Eg: if 5<10 and 5>2 and 5 is an odd number my output should be 5 is a valid number. Please help with this doubt.
8 odpowiedzi
+ 3
You can do that in this way:
x = int(input())
if x < 10 and x > 2 and x % 2 != 0:
print("this is true")
+ 3
Please first save your attempt on SL Playground and link here.
+ 1
Tharun How about this one? :-
if 2 < x < 10 and x & 1: print("valid")
# Hope this helps
+ 1
if(num>2 && num<10 && num%2!=0)
0
You can chain the condition with 'and', 'or'. 'and' you need to have 2 or more conditions being satisfied.
0
Iam unable to do it on my mobile
0
I will share the link later.Thank u all
- 3
Can u please give me the answer for flipbuzz challenge in control structures lesson