Does this exist in Python? I want to combine an If statement that is very repetitive.
# ORIGINAL IF STATEMENT
if a < 100 and b < 100 and c < 100:
#pass
# I KNOW THIS IS WRONG, I JUST WANT TO KNOW IF THERE IS A WAY TO MAKE THE IF CONDITION SHORTER
if [a,b,c] < 100:
#pass
You can use the built-in all():
if all(item < 100 for item in [a, b, c]):
You can also use the built-in max():
if max(a, b, c) < 100:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With