Ticket Office ||| how to solve it....? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Ticket Office ||| how to solve it....?

You are analyzing sales data from a ticket office. The ticket for an adult is $20, while the ticket for a child under 18 is $5. The data you are given is in a dictionary format, where the keys are the sold ticket numbers, and the values are the customer ages. For example, "123-08": 24 means that the ticket was bought a 24 year old. Your goal is to calculate how much more money the office would make if it would change the ticket discount age to the given input. So, your program needs to take an integer as input and output the percentage of revenue growth, if the discount was given to people under that age. For example, if the office made $15000 with the original discount age, and would make $18000 with 14 as the discount age, then the growth would be ((18000-15000)/15000)*100 = 20% So, for the input 14, your program should output 20. The output should be an integer (use int() to convert the result). https://code.sololearn.com/crwQ1KbxKU5e/?ref=app

3rd Aug 2021, 1:08 AM
Md Shihab Shahriar Rashu
Md Shihab Shahriar Rashu - avatar
4 Answers
+ 2
https://code.sololearn.com/cRppr9Gswiw1/?ref=app Is this what you mean
3rd Aug 2021, 1:49 AM
Abs Sh
Abs Sh - avatar
0
✩✮★✮✩ thanks bro....💚
3rd Aug 2021, 1:54 AM
Md Shihab Shahriar Rashu
Md Shihab Shahriar Rashu - avatar
0
Abs Sh thank you bro....💚 It's working....🙂
3rd Aug 2021, 1:54 AM
Md Shihab Shahriar Rashu
Md Shihab Shahriar Rashu - avatar
0
This was my answer : #The money that office would make with original (18year) discount age n = 0 for v in data.values(): if v >= 18: n += 20 else: n += 5 ##The money that office would make with given age n2 = 0 for v in data.values(): if v >= age: n2 += 20 else: n2 += 5 #calculate how much more money the office would make with given age x = int(((n2-n)/n)*100) print(x)
21st Sep 2021, 4:53 PM
Murtada abed
Murtada abed - avatar