Answer:
count = 0
while count != 8:
height = float(input("Enter height of the rider: "))
if height >= 140:
print("You are allowed to ride")
count += 1
else:
if height >= 120:
answer = input("Is the rider with an adult (yes/no): ")
if answer == "yes":
print("You are allowed to ride")
count += 1
else:
print("You are not allowed to ride")
else:
print("You are not allowed to ride")
Explanation:
Initialize the count as 0, it will count the number of people allowed to ride
Create a while loop that iterates while count is not equal to 8
Inside the loop, ask the user for the height. If the height is greater than or equal to 140, print "You are allowed to ride" and increment the count by 1. Otherwise, check if the height is greater than or equal to 120. If it is not, print "You are not allowed to ride". If it is, ask if the rider is with an adult or not. If it is not, print "You are not allowed to ride". If it is print "You are allowed to ride" and increment the count by 1.