Okay, thanks. What was the primary reason that you would not recommend this as a switch?
Also, wouldn’t the ‘less than age’ create the possibilities of multiple age ID’s? In other words someone who is 18 could qualify as a ‘teen’, and ‘adult’. Still a noob, so not sure if I am missing an order of operations thing here.
switch is useful when you have a few options, here there are a lot of options (139 cases)
no, if you do:
else if (age <= 19){return 'teen'}
else if (age <= 64){return 'adult'}
someone is 18 will always give teen. Two reasons, once a condition evaluates to true, the remaining conditions are skipped
furthermore, by default a function return None at the end of the function (implicit), if we want to return something else at the end of the function, we can use the return keyword. So once the return is reached, the function ends