0

I need help , how to make ticketing system to calculate the cost of tickets for persons older than 3 years

Hello

21st Feb 2022, 8:19 PM
kareem nada
kareem nada - avatar
7 Respostas
+ 1
#there: def main() -> str: print('Enter the ages for 5 persons') arr = [int(input(f'Age {_} : '))for _ in range(5)] price = 0 for i in arr: if i>=3: price+=100 return 'Total price for 5 persons is %d'%price if __name__=='__main__': print(main())
22nd Feb 2022, 6:28 AM
Ervis Meta
Ervis Meta - avatar
+ 1
Which course, which task? Please link your code attempt
21st Feb 2022, 8:31 PM
Lisa
Lisa - avatar
+ 1
Ticketing System: 1-Number of available tickets 2-Separated Prices for adults and children (as if ◉‿◉) 3- Total number of reservations 4- Amm... This will be the number of available tickets to sold 5- ... I guess the total sum of cash earned .... 6- Final monetary earning and other thing that can be out of topic ಡ ͜ ʖ ಡ. Anyway, I guess this is a code practice here and you should analyse carefully what this challenge wants ... If you post an attempt of your here, I will give you a big help: by explaining the steps (•‿•).
21st Feb 2022, 8:55 PM
Ervis Meta
Ervis Meta - avatar
+ 1
#Decima total = 0 x = 0 while x < 5: age = int(input()) if age >= 3: total += 100 x += 1 print(total)
21st Feb 2022, 9:22 PM
Goodness Ogunlana
+ 1
Good start ! Make it more managable like: people = [int(input()) for _ in range(5)] # list of prices prices = [(i>4 and 100)or 50 for i in people] print(prices) adults = [i for i in prices if i == 100] kids = [i for i in prices if i == 50] print(adults,sum(adults)) print(kids,sum(kids))
21st Feb 2022, 9:28 PM
Ervis Meta
Ervis Meta - avatar
0
Thanks everyone it's done
22nd Feb 2022, 8:49 AM
kareem nada
kareem nada - avatar