Python Coding You are to create a function where you determine whether a kid can
ID: 3772975 • Letter: P
Question
Python CodingYou are to create a function where you determine whether a kid can ride a rollercoaster or something. You are given a floating point value for height, and have with_adult that is a boolean value (another parameter). If the height is greater than 46, return True (meaning the child can ride. If the height is less than 46 but greater than 36, check if the child is with an adult. If that is True, then the child may go on the ride. If the child is less then 36, then the child may not ride (return False). Python Coding
You are to create a function where you determine whether a kid can ride a rollercoaster or something. You are given a floating point value for height, and have with_adult that is a boolean value (another parameter). If the height is greater than 46, return True (meaning the child can ride. If the height is less than 46 but greater than 36, check if the child is with an adult. If that is True, then the child may go on the ride. If the child is less then 36, then the child may not ride (return False). Python Coding
Explanation / Answer
def test(value):
if value > 46:
return False
elif value < 46 & value >36:
return True
else:
return False
value=float(input("Enter the student height:"))
if(test(value)) :
print (" Child can go on ride")
elif (test(value)):
if value > 18 :
print("Child can go on ride")
else:
print("child can not go on ride")
else:
print("child can not go on ride")
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.