+ 2
How can I create a python code on ticket system based on age of the group?
Problem required using 'continue'
11 Answers
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)
+ 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)
+ 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.
+ 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.
+ 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
+ 2
Canadian_Halo _ ,
a necessary condition is to use the "continue" construction.
+ 1
ages = [int(i) for i in input().split()]
money = 0
for age in ages:
if age < 3: continue
else: money+=100
print(money)
+ 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.
0
Does anyone here have the inventory application source code?
0
If this is for what u thought it was I hadn't used continue
0
I