Problem: The Danger Panda roller coaster requires that riders be at least 1.6 meters tall and under 1.9 meters tall. Return True iff a person, whose height in meters is given as the argument, is allowed to ride the Danger Panda. My solution(code): def allow_rider(height): """(float) -> bool Return True iff height is within the height parameters. Maximum Height of rider: 1.9 meters Minimum Height of rider: 1.6 meters allow_rider(1.7) True allow_rider (1.4) False """ if (height >= 1.6 and height <= 1.9): return True else: return False
Teachers comment: The following test cases failed: | | test_allow_rider_hair_too_tall - IncorrectReturnValue | | Think about what happens with values near 1.9.
could somebody help me understand waht this means
and what i have to do to correct it
def rider(height): return (height >= 1.6) && (height < 1.9); There's no problem. The thing to know is that they value has to be LESS THAN 1.9, so if you use the less than operator its all good. The problem is that it says "if and only if they are at least 1.6 meters and UNDER 1.9 meters". "Under 1.9 meters" implies that it does not include 1.9 meters, but it will include 1.8999999... So that's what you want, I think. You could write it somewhat more concisely as such: def rider(height): return 1.6 <= height < 1.9
alright thanks, if i messaged you through the other message thing do you think youd be able to help me with 2 more questions?
i dont know.. maybe? i'll try;)
alright thanks so much ill inbox them to you right now
medal me first? ;)
ye sure anything
i sent the question to you
Join our real-time social learning platform and learn together with your friends!