Help me to solve REVENUE GROWTH ANALYSIS | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 6

Help me to solve REVENUE GROWTH ANALYSIS

5th Feb 2021, 12:17 PM
Nafis Sadiq Bhuyan
Nafis Sadiq Bhuyan - avatar
24 Answers
+ 7
data = { "100-90": 25, "42-01": 48, "55-09": 12, "128-64": 71, "002-22": 18, "321-54": 19, "097-32": 33, "065-135": 64, "99-043": 80, "111-99": 11, "123-019": 5, "109-890": 72, "132-123": 27, "32-908": 27, "008-09": 25, "055-967": 35, "897-99": 44, "890-98": 56, "344-32": 65, "43-955": 59, "001-233": 9, "089-111": 15, "090-090": 17, "56-777": 23, "44-909": 27, "13-111": 21, "87-432": 15, "87-433": 14, "87-434": 23, "87-435": 11, "87-436": 12, "87-437": 16, "94-121": 15, "94-122": 35, "80-089": 10, "87-456": 8, "87-430": 40 } age = int(input()) #your code goes here old=0 new=0 for i in data.values(): if i>=18: old+=20 else: old+=5 for i in data.values(): if i>=age: new+=20 else: new+=5 print(int((new-old)*100/old))
25th May 2022, 4:48 AM
S.M.K.Santhush
+ 6
Please show us your attempt so far.
5th Feb 2021, 12:26 PM
noteve
noteve - avatar
+ 4
HI, this works for me :) age = int(input()) #your code goes here price_adult = 20 price_discount = 5 overall_earnings = 0 overall_earnings_new = 0 for i in data.values(): if i >= 18 and i >= age: overall_earnings += price_adult overall_earnings_new += price_adult elif i < 18 and i < age: overall_earnings += price_discount overall_earnings_new += price_discount else: overall_earnings += price_discount overall_earnings_new += price_adult increase = ((overall_earnings_new-overall_earnings)/overall_earnings)*100 print(int(increase))
22nd Jun 2022, 9:31 AM
Sebastian Dötze
+ 2
***shortest code *** works 1000000%%%% age = int(input()) fixed = 0 su = 0 for i in data.values(): if i < 18: fixed += 5 else: fixed += 20 for i in data.values(): if i < age: su += 5 else: su += 20 a = ((fixed - su)/fixed) * 100 print(int(abs(a)))
9th Oct 2022, 1:59 PM
Emmanuel Alem
Emmanuel Alem - avatar
+ 1
can anyone tell me what is wrong with this code? data = { "100-90": 25, "42-01": 48, "55-09": 12, "128-64": 71, "002-22": 18, "321-54": 19, "097-32": 33, "065-135": 64, "99-043": 80, "111-99": 11, "123-019": 5, "109-890": 72, "132-123": 27, "32-908": 27, "008-09": 25, "055-967": 35, "897-99": 44, "890-98": 56, "344-32": 65, "43-955": 59, "001-233": 9, "089-111": 15, "090-090": 17, "56-777": 23, "44-909": 27, "13-111": 21, "87-432": 15, "87-433": 14, "87-434": 23, "87-435": 11, "87-436": 12, "87-437": 16, "94-121": 15, "94-122": 35, "80-089": 10, "87-456": 8, "87-430": 40 } age = int(input()) #your code goes here d_sum = 0 o_sum = 0 for i in data.values(): if i > 18: d_sum += 20 else: d_sum += 5 for o in data.values(): if o > age: o_sum += 20 else: o_sum += 5 sum = ((o_sum-d_sum)/d_sum)*100 print(int(sum))
6th May 2022, 10:55 AM
Mustafa Al-jawdah
Mustafa Al-jawdah - avatar
+ 1
total, total_new = 0, 0 for i in data.values(): if i >= age: total_new += 20 else: total_new += 5 if i >= 18: total += 20 else: total += 5 print(int((total_new - total) / total * 100)) *just for your reference dont be cheating okay :)
7th Dec 2022, 11:59 AM
Angga Banny Ridwan Syahputra
Angga Banny Ridwan Syahputra - avatar
0
Abhay this is in python data structure course End of module project
5th Feb 2021, 12:35 PM
Nafis Sadiq Bhuyan
Nafis Sadiq Bhuyan - avatar
0
Nafis Sadiq Bhuyan i still don't know where to search for it , probably copy paste the question with your code attempt so people can actually help you.
5th Feb 2021, 12:39 PM
Abhay
Abhay - avatar
0
Thanks so much
25th Jun 2021, 1:21 AM
David Daniel
0
Your welcome
25th Jun 2021, 1:23 AM
Tavel Mccook
Tavel Mccook - avatar
0
This is my version in functional programming paradigm.... https://code.sololearn.com/c2xTaB112w37/?ref=app
12th Jul 2021, 6:50 PM
Azhar Faturohman Ahidin
Azhar Faturohman Ahidin - avatar
0
I honestly can NOT see how the answers work for this (age16=5% and age10=31%): Here below I have carried out a full breakdown: data = { "100-90": 25, "42-01": 48, "55-09": 12, "128-64": 71, "002-22": 18, "321-54": 19, "097-32": 33, "065-135": 64, "99-043": 80, "111-99": 11, "123-019": 5, "109-890": 72, "132-123": 27, "32-908": 27, "008-09": 25, "055-967": 35, "897-99": 44, "890-98": 56, "344-32": 65, "43-955": 59, "001-233": 9, "089-111": 15, "090-090": 17, "56-777": 23, "44-909": 27, "13-111": 21, "87-432": 15, "87-433": 14, "87-434": 23, "87-435": 11, "87-436": 12, "87-437": 16, "94-121": 15, "94-122": 35, "80-089": 10, "87-456": 8, "87-430": 40 } age = int(input()) undernew = dict() underold = dict() overnew = dict() overold = dict() for (key, value) in data.items(): if value < age: undernew[key] = value if value < 24: underold[key] = value if value > age: overnew[key] = value if value > 24: overold[key] = value # Amount made for over 24s oldadu = len(overold.values())*20 # Amount made for over custom age newadu = len(overnew.values())*20 # Amount made for under 24s oldkid = len(underold.values())*5 # Amount made for under custom age newkid = len(undernew.values())*5 print("Made from children under 24 :
quot;, oldkid) print("Made from children under", age, ":
quot;, newkid) a = oldkid - newkid c = oldkid + oldadu print("Total revenue BEFORE change :
quot;, c) print("Difference in child profit : -
quot;, a) print("Made from adults over 24 :
quot;, oldadu) print("Made from adults over", age, " :
quot;, newadu) b = newadu - oldadu print("Difference in adult profit : +
quot;, b) d = newkid + newadu print("Total revenue AFTER change :
quot;, d) print("Profit from change :
quot;, b-a) What am I missing here?!?
6th Aug 2022, 2:59 PM
Peter Haas
Peter Haas - avatar
0
My bad, I missed the "over 18" bit in bold. Doh!
6th Aug 2022, 3:03 PM
Peter Haas
Peter Haas - avatar
0
data = { "100-90": 25, "42-01": 48, "55-09": 12, "128-64": 71, "002-22": 18, "321-54": 19, "097-32": 33, "065-135": 64, "99-043": 80, "111-99": 11, "123-019": 5, "109-890": 72, "132-123": 27, "32-908": 27, "008-09": 25, "055-967": 35, "897-99": 44, "890-98": 56, "344-32": 65, "43-955": 59, "001-233": 9, "089-111": 15, "090-090": 17, "56-777": 23, "44-909": 27, "13-111": 21, "87-432": 15, "87-433": 14, "87-434": 23, "87-435": 11, "87-436": 12, "87-437": 16, "94-121": 15, "94-122": 35, "80-089": 10, "87-456": 8, "87-430": 40 } age = int(input()) adult = 20 underage = 5 sales = 0 for value in data.values(): if value < age: sales += underage else: sales+= adult #print(sales) sales_2 = 0 for value in data.values(): if value < 18: sales_2 += underage else: sales_2 += adult #print(sales_2) revenue= int(((sales-sales_2)/sales_2)*100) print(revenue)
31st Oct 2022, 7:52 PM
Hebert Aranda
0
age = int(input()) #your code goes here u_age = 18 # underage pr_a = 20 # price adults pr_c = 5 # price childs def profitEst(data, u_age, trgt, pr_a, pr_c): ages = list(data.values()) adults_1 = sum(map(lambda a : a >= u_age, ages)) childs_1 = sum(map(lambda c : c < u_age, ages)) total_1 = adults_1 * pr_a + childs_1 * pr_c adults_2 = sum(map(lambda a : a >= trgt, ages)) childs_2 = sum(map(lambda c : c < trgt, ages)) total_2 = adults_2 * pr_a + childs_2 * pr_c return (total_2 - total_1)/total_1 * 100 print(int(profitEst(data, u_age, age, pr_a, pr_c)))
27th Nov 2022, 4:49 AM
Alexander Davydov
Alexander Davydov - avatar
0
Please I need help, my code isn't working for one of the test case
9th Dec 2022, 8:59 PM
Udoh Ekemini
0
Here my solution: old18= 0 old14=0 i18 = 0 data = { "100-90": 25, "42-01": 48, "55-09": 12, "128-64": 71, "002-22": 18, "321-54": 19, "097-32": 33, "065-135": 64, "99-043": 80, "111-99": 11, "123-019": 5, "109-890": 72, "132-123": 27, "32-908": 27, "008-09": 25, "055-967": 35, "897-99": 44, "890-98": 56, "344-32": 65, "43-955": 59, "001-233": 9, "089-111": 15, "090-090": 17, "56-777": 23, "44-909": 27, "13-111": 21, "87-432": 15, "87-433": 14, "87-434": 23, "87-435": 11, "87-436": 12, "87-437": 16, "94-121": 15, "94-122": 35, "80-089": 10, "87-456": 8, "87-430": 40 } age = int(input()) #your code goes here old18= 0 old14=0 i18 = 0 newA = 0 for value in data.values(): if value >= 18: old18 +=1 if value < 18: old14 +=1 oldRevenue = old18*20+old14*5 for value in data.values(): if value < 18 and value >=age: i18 += 1 revenuediff = i18*15 #print('RevenueDiff',revenuediff) #print('old revenue',oldRevenue) increaseRate = (revenuediff/oldRevenue)*100 print(int(increaseRate)) The main issue was to choocw between >= , >, <=, <
31st Dec 2022, 11:15 AM
Saba Fabio
0
data = { "100-90": 25, "42-01": 48, "55-09": 12, "128-64": 71, "002-22": 18, "321-54": 19, "097-32": 33, "065-135": 64, "99-043": 80, "111-99": 11, "123-019": 5, "109-890": 72, "132-123": 27, "32-908": 27, "008-09": 25, "055-967": 35, "897-99": 44, "890-98": 56, "344-32": 65, "43-955": 59, "001-233": 9, "089-111": 15, "090-090": 17, "56-777": 23, "44-909": 27, "13-111": 21, "87-432": 15, "87-433": 14, "87-434": 23, "87-435": 11, "87-436": 12, "87-437": 16, "94-121": 15, "94-122": 35, "80-089": 10, "87-456": 8, "87-430": 40 } age = int(input()) #your code goes heren money = 0 nmoney = 0 for value in data.values(): if value >= 18 : money += 20 else: money+= 5 for value in data.values(): if value >= age : nmoney += 20 else: nmoney+= 5 #to avoid negetive values if nmoney > money : per = ((nmoney - money)/money)*100 else: per = ((money - nmoney)/money)*100 print(int(per))
5th Jan 2023, 7:03 AM
Pron Noy
Pron Noy - avatar
0
data = { "100-90": 25, "42-01": 48, "55-09": 12, "128-64": 71, "002-22": 18, "321-54": 19, "097-32": 33, "065-135": 64, "99-043": 80, "111-99": 11, "123-019": 5, "109-890": 72, "132-123": 27, "32-908": 27, "008-09": 25, "055-967": 35, "897-99": 44, "890-98": 56, "344-32": 65, "43-955": 59, "001-233": 9, "089-111": 15, "090-090": 17, "56-777": 23, "44-909": 27, "13-111": 21, "87-432": 15, "87-433": 14, "87-434": 23, "87-435": 11, "87-436": 12, "87-437": 16, "94-121": 15, "94-122": 35, "80-089": 10, "87-456": 8, "87-430": 40 } age = int(input()) #your code goes here #Finding the initial revenue. t1=0 for x in data: buying_age=(data.get(x)) if buying_age<18: t1 +=5 elif buying_age>=18: t1 +=20 #Finding the new revenue. t2=0 for x in data: buying_age=(data.get(x)) if buying_age<age: t2 +=5 elif buying_age>=age: t2 +=20 #Finding out % increase in revenue. revenue_up=((t2-t1)/t1)*100 print(int(revenue_up))
5th Jan 2023, 3:55 PM
Wei Kee Keoh
Wei Kee Keoh - avatar