0
If statement + logical and/or
Can I create the code for below scenario by using If statement + logical and/or? Output may more than 1 subjected to it fall in the group. Note: Using "," to separate the data. Sport, Age yrs, Males (VO2Max), Females (VO2Max) Basketball, 18 - 30, 40 â 60, 43 â 60 Bicycling, 18 - 26, 62 â 74, 47 â 57 Canoeing, 18 - 26, 55 â 67, 47 â 67 Gymnastics, 18 - 22, 52 â 58, 36 â 50 Swimming, 10 - 25, 50 â 70, 40 â 60
1 Answer
0
It works like this:
( I asume the sport is a string and the numbers are the age as integer.)
if 'Basketball' and (( age >= 18 and age <= 30) or (age >= 40 and age <= 60) or (age >= 43 and age <= 60))
# Do something.
watch out for the '((' and the '))' that's the age part. You can replicate the code for any sports, but change the age numbers.