0
Can someone please help me. I'm stuck with this practice. I tried everything but #test1 and #test2 says my output are different
You are making a ticketing system. The price of a single ticket is $100. For children under 3 years of age, the ticket is free. Your program needs to take the ages of 5 passengers as input and output the total price for their tickets.
20 Antworten
+ 11
Where are you in a hurry?
Do you want to learn how to program or just get certified?
Why do you think SoloLearn did not provide access to other users' test solutions?
If you are constantly given ready-made solutions, how will you test your knowledge?
You do not believe that you have done a lot of mistakes?
Here is your corrected code:
total=0
passengers=0
while passengers<5: #1. No ":";
passengers += 1 #2. No counter;
age=int(input())
if (age<=3): # 3. No indentation; 4. wrong condition;
continue
else: #5. No indentation;
total+=100 #6-7. No indentation;
print(total)
+ 5
Thank you ravilnicki and Solo. It worked.
+ 4
You made 7 mistakes in 9 lines 😱
you don't know about indentation in python???
Before you start the task, you need to learn everything from the very beginning.
+ 4
Solo, I'll make sure I go back to my indentation lessons. Thank you for correcting my mistakes for me.
+ 4
small GENUIS💯🇬🇭🤘, if you want to contact someone personally, you can do it via @
+ 3
total = 0
i = 0
while i < 5 :
age = int(input())
if age > 3 :
total = total + 100
i += 1
print(total)
+ 2
Please can you point out the seven mistakes. I learnt everything from the beginning. But this practice got me confused. But apart from the indentation, is the solution wrong?
+ 1
This is how I solved it.
total=0
passengers=0
while passengers<5
age=int(input())
if (age>3):
continue
else:
total+=100
print(total)
PLEASE HELP I'M STUCK!!
+ 1
Now it says the continue is not in the loop
+ 1
Please I'm a total newbie so can you please clarify that a little,please.
+ 1
The penultimate thing
+ 1
I know about indentation
+ 1
I made seven mistakes?!
+ 1
But I was doing everything right until this practice
+ 1
Ha, ha, not funny, Manav Roy
0
I guess I was in hurry to type my comment because i needed help urgently. And I'm not relying on ready-made answers. I was doing alright until this practice got a little confusing. Thanks very much for helping me.
- 1
Use elif instead of if continue else: figment ok