0
To young to ride
persons_ages = [] i = 0 while i<3: pers_age = int(input()) persons_ages.append(pers_age) i+=1 #your code goes here for i in range(10): if i > 17: print ("too young!") break else: print("Get ready!") It passes on case 1,2,4,5 Not sure why it does not pass on case 3
9 ответов
+ 8
Kim Hammar-Milliner ,
is this a sololearn code coach exercise? if yes, can you please mention the name of the tutorial and the lesson / exercise number?
thanks!
+ 2
Thanks that solved it..
0
Here is the description
The carousel is designed for 3 people who are each at least 16 years old.
You are given a program that takes all 3 passengers' ages as inputs and inserts them in a list. Complete the program so that if it finds a value less than 16, it breaks the loop and outputs "Too young!".
If the age requirement is satisfied, the program outputs "Get ready!".
Sample Input
18
26
19
Sample Output
Get ready!
0
if i > 17:
should be
if I < 17:
0
And instead of looping over i in the for loop you should loop over persons.ages.
0
Here is my code, now it fails on case 2, 4 and passes 1,3,5
persons_ages = []
i = 0
while i<3:
pers_age = int(input())
persons_ages.append(pers_age)
i+=1
#your code goes here
for persons_ages in range(10):
if i > 16:
print ("too young!")
break
else:
print("Get ready!")
0
Try this:
for age in persons_ages:
if age < 17
0
That does not solve it.
0
How about this?
https://code.sololearn.com/cbGbhjFMaGOI/?ref=app