+ 1

What does this mean?😖😞😓😩😫(how do I find the discount)tell me how I find the discount (note:-only how to find discount

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).

11th Apr 2021, 5:07 AM
Codemurai
Codemurai - avatar
2 odpowiedzi
11th Apr 2021, 5:19 AM
A͢J
A͢J - avatar
0
Well, As you are unable to understand that discount thing, let me break it down for you. For every person below the age of 18, $15 discount is given. Now, question asks how much more money would be made if that age is reduced (discount offered to lesser people means more revenue). The amount of extra revenue generated this way will be equal to the discount that was offered to the eligible people earlier but is no longer provided with the change in policy. The current criteria for that $15 dollar is age should be lesser than 18. Suppose, now only those who are below 16 will be given that $15 discount. How will this impact the revenue? Earlier those who were lesser than 18 and were paying only $5 will now have to pay 15$ more(discount amount for each person) if they are 16 or above. I hope, that explains the concept behind this question to you. now to calculate the discount, we can do this. #disc here means the discount earlier being given but now stands withdrawn with change in policy. disc = 0 for value in data.values(): if age <= value < 18: disc += 15 Now that we know the disc earlier being offered, we can calculate the growth in revenue. new_revenue = earlier_revenue + disc Now, You can calculate the difference between them and then the percentage. Secondly, you can go with another approach, total = 530 #to avoid too much math here, simply posted the value which is basically the revenue under current policy. #calculate new increased revenue this way new_total = 0 for value in data.values(): if value < age: new_total += 5 else: new_total += 20 rest is simple math. percentage = (new_total - total)/total * 100 print(int(percentage))
11th Apr 2021, 6:00 AM
CHANDAN ROY
CHANDAN ROY - avatar