How to create conditional lambda function in Python

2 Answers

0 votes
f = lambda x : True if (x > 3 and x <= 7) else False
 
print(f(4))
print(f(9))



'''
run:

True
False

'''

 



answered Jan 31, 2020 by avibootz
0 votes
f = lambda x : x > 3 and x <= 7
 
print(f(4))
print(f(9))



'''
run:

True
False

'''

 



answered Jan 31, 2020 by avibootz

Related questions

...