# Number 6 There should be no "input"; weight is a parameter of the function. There should be no printing; the string should be returned. # Version from the solution def cherries(weight): if weight >= 10.4: return '9 Row' elif weight >= 8.6: return '10 Row' elif weight >= 7.1 return '11 Row' else: return '12 Row' # following isn't wrong; but the tests are more complex than needed def cherries(weight): if weight >= 10.4: return '9 Row' elif weight >= 8.6 and weight < 10.4: return '10 Row' elif weight >= 7.1 and weight < 8.6: return '11 Row' else: return '12 Row' # This doesn't work; why? Try it with argument 20. The answer should be '9 row' but it is '11 row' def cherries(weight): if weight >= 10.4: s = '9 Row' if weight >= 8.6: s = '10 Row' if weight >= 7.1: s = '11 Row' if weight < 7.1: s = '12 Row' return s # On the other hand, this works, even though it too uses if's instead of elifs: def cherries(weight): if weight >= 10.4: return '9 Row' if weight >= 8.6: return '10 Row' if weight >= 7.1: return '11 Row' if weight < 7.1: return '12 Row' # This doesn't work; why? Try it with argument 5. The answer should be '12 Row' but it is '10 Row' def cherries(weight): if weight >= 10.4: return '9 Row' elif weight >= 8.6 or weight < 10.4: return '10 Row' elif weight >= 7.1 or weight < 8.6: return '11 Row' else: return '12 Row' # For number 7, consider the condition in the while loop. # It is supposed to be true if ans is anything other than "0" or "1" while not (ans == "0" or ans == "1"): #correct while not ans == "0" and not ans == "1": #correct while ans != "0" and ans != "1": #correct while not ans == "0" or ans == "1": # True if ans is "1"! need ()'s while ans != '0' or ans != '1': # this is true for ANY value of ans; try it! while not ans == "0" or not ans == "1" # this is true for ANY value of ans; try it!