+ 2

How can I create a python code on ticket system based on age of the group?

Problem required using 'continue'

8th Feb 2023, 6:29 PM
Satyaki Roy Gosthipaty
Satyaki Roy Gosthipaty - avatar
11 RĂ©ponses
0
Try replacing the input command to age = int(input()) And get rid of For age in ages: For ex age = int(input()) total = 0 if age < 3: Money = money + 100 Elif age > 3: Money = money + 0 Print(money)
10th Feb 2023, 3:27 PM
Canadian_Halo _
+ 10
Satyaki Roy Gosthipaty , your questiom seems to be incomplete. the post should include: > the programming language (to be placed in tags) > a clear task description with input / output sample > tutorial name and exercise name / number > a link that points to your code try > a description what exactly your issue is, (if possible including an error message)
8th Feb 2023, 6:57 PM
Lothar
Lothar - avatar
+ 8
Mikhail , unfortunately the input can not be given as your code expected it (all values in one line, separated by a space). the code coach exercise experts 5 inputs, each in a separate run.
9th Feb 2023, 8:05 PM
Lothar
Lothar - avatar
+ 3
Firstly, please try to attempt the code and if you have doubt then post the code we will help you to try to solve your doubt.
8th Feb 2023, 7:14 PM
Sakshi [Offline 🙃]
Sakshi [Offline 🙃] - avatar
+ 2
Lesson : break and continue Exercise : Time to practice (code coach) Description : 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. Sample Input 18 24 2 5 42 Sample Output 400
8th Feb 2023, 7:03 PM
Satyaki Roy Gosthipaty
Satyaki Roy Gosthipaty - avatar
+ 2
Canadian_Halo _ , a necessary condition is to use the "continue" construction.
10th Feb 2023, 11:07 PM
Mikhail
Mikhail - avatar
+ 1
ages = [int(i) for i in input().split()] money = 0 for age in ages: if age < 3: continue else: money+=100 print(money)
9th Feb 2023, 2:46 PM
Mikhail
Mikhail - avatar
+ 1
I agree, this is more of an example. The main task was to apply the "continue", because it was the question of the author - in first topic.
9th Feb 2023, 11:02 PM
Mikhail
Mikhail - avatar
0
Does anyone here have the inventory application source code?
9th Feb 2023, 7:26 PM
Rahmad Hidayat
Rahmad Hidayat - avatar
0
If this is for what u thought it was I hadn't used continue
10th Feb 2023, 11:09 PM
Canadian_Halo _
0
I
10th Feb 2023, 11:10 PM
Canadian_Halo _