0
Shorter
How can be this be shorter "if x >40 and x <70:"? My emulator keeps telling me that this could be shorter
6 Answers
+ 12
if 40 < x < 70:
or
if 70 > x > 40:
+ 4
if x in range (41, 70):
+ 4
It's cool, but honestly saying I don't like this notation, it looks a bit awkward :)
+ 2
Maybe:
0 if x > 40 and x < 70 else 1
If that statement is true it'll return true and if false will return false.
+ 2
Kuba SiekierzyĆski It's useful for short, repetitive conditional statements. I agree it shouldn't be used as a full-time replacement for if/else.
+ 1
Kuba SiekierzyĆski Thanks...I think i im dumb for not think in this option haha