+ 1

The code doesn't output anything . Can you tell me what is wrong ?

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/cpTPa8n3Ky1D/?ref=app

10th Feb 2022, 3:30 PM
Programer F_K
Programer F_K - avatar
1 Answer
+ 1
*1 you are using while instead of if in first loop print+=5 or print+=20 is enough but why need sum+=price it make big difference. if you use sum then just use price = 5, = , instead of += if value==18 case missing... value=age #replacing value to age, it's same in all iterations.. if value<18 : price+=5 .... you need to compare here with input age, with list values , like if value<age : price = 5 else : price = 20 final result need as int type print( int(pay) )
10th Feb 2022, 3:51 PM
Jayakrishna 🇮🇳