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.

1st Feb 2022, 11:39 PM
Hafsa Ahmed(small GENUIS)💯🇬🇭🤘
Hafsa Ahmed(small GENUIS)💯🇬🇭🤘 - avatar
20 Respuestas
+ 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)
2nd Feb 2022, 7:08 AM
Solo
Solo - avatar
+ 5
Thank you ravilnicki and Solo. It worked.
2nd Feb 2022, 11:26 PM
Hafsa Ahmed(small GENUIS)💯🇬🇭🤘
Hafsa Ahmed(small GENUIS)💯🇬🇭🤘 - avatar
+ 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.
2nd Feb 2022, 12:42 AM
Solo
Solo - avatar
+ 4
Solo, I'll make sure I go back to my indentation lessons. Thank you for correcting my mistakes for me.
2nd Feb 2022, 11:28 PM
Hafsa Ahmed(small GENUIS)💯🇬🇭🤘
Hafsa Ahmed(small GENUIS)💯🇬🇭🤘 - avatar
+ 4
small GENUIS💯🇬🇭🤘, if you want to contact someone personally, you can do it via @
3rd Feb 2022, 2:19 AM
Solo
Solo - avatar
+ 3
total = 0 i = 0 while i < 5 : age = int(input()) if age > 3 : total = total + 100 i += 1 print(total)
3rd Feb 2022, 10:27 PM
树上的鱼
树上的鱼 - avatar
+ 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?
2nd Feb 2022, 1:08 AM
Hafsa Ahmed(small GENUIS)💯🇬🇭🤘
Hafsa Ahmed(small GENUIS)💯🇬🇭🤘 - avatar
+ 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!!
1st Feb 2022, 11:53 PM
Hafsa Ahmed(small GENUIS)💯🇬🇭🤘
Hafsa Ahmed(small GENUIS)💯🇬🇭🤘 - avatar
+ 1
Now it says the continue is not in the loop
2nd Feb 2022, 12:13 AM
Hafsa Ahmed(small GENUIS)💯🇬🇭🤘
Hafsa Ahmed(small GENUIS)💯🇬🇭🤘 - avatar
+ 1
Please I'm a total newbie so can you please clarify that a little,please.
2nd Feb 2022, 12:25 AM
Hafsa Ahmed(small GENUIS)💯🇬🇭🤘
Hafsa Ahmed(small GENUIS)💯🇬🇭🤘 - avatar
+ 1
The penultimate thing
2nd Feb 2022, 12:29 AM
Hafsa Ahmed(small GENUIS)💯🇬🇭🤘
Hafsa Ahmed(small GENUIS)💯🇬🇭🤘 - avatar
+ 1
I know about indentation
2nd Feb 2022, 1:02 AM
Hafsa Ahmed(small GENUIS)💯🇬🇭🤘
Hafsa Ahmed(small GENUIS)💯🇬🇭🤘 - avatar
+ 1
I made seven mistakes?!
2nd Feb 2022, 1:03 AM
Hafsa Ahmed(small GENUIS)💯🇬🇭🤘
Hafsa Ahmed(small GENUIS)💯🇬🇭🤘 - avatar
+ 1
But I was doing everything right until this practice
2nd Feb 2022, 1:03 AM
Hafsa Ahmed(small GENUIS)💯🇬🇭🤘
Hafsa Ahmed(small GENUIS)💯🇬🇭🤘 - avatar
+ 1
Ha, ha, not funny, Manav Roy
3rd Feb 2022, 10:58 PM
Hafsa Ahmed(small GENUIS)💯🇬🇭🤘
Hafsa Ahmed(small GENUIS)💯🇬🇭🤘 - avatar
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.
2nd Feb 2022, 11:10 PM
Hafsa Ahmed(small GENUIS)💯🇬🇭🤘
Hafsa Ahmed(small GENUIS)💯🇬🇭🤘 - avatar
- 1
Use elif instead of if continue else: figment ok
3rd Feb 2022, 2:18 PM
Mahaim Luxuruyu