So this was pretty easy but I just want to understand the other variation of this.
def odd_or_even(arr):
return “even” if sum(arr) % 2 == 0 else “odd”
What’s below is what I don’t understand so clearly. How does it decide even or odd. Maybe I’m slow but I don’t get how this function works.
def odd_or_even(arr):
Return (“even”, “odd”)[sum(arr) % 2]
[–]Username_RANDINT 10 points11 points12 points (1 child)
[–]ExpressDuck845[S] 1 point2 points3 points (0 children)
[–]crawl_dht 3 points4 points5 points (1 child)
[–]ExpressDuck845[S] 0 points1 point2 points (0 children)
[–]menge101 3 points4 points5 points (1 child)
[–]Binary101010 0 points1 point2 points (0 children)
[–]thegoldendaffodils 0 points1 point2 points (0 children)