Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weekend challenge #1208

Closed
As-Sulamy opened this issue Feb 16, 2025 · 0 comments
Closed

Weekend challenge #1208

As-Sulamy opened this issue Feb 16, 2025 · 0 comments

Comments

@As-Sulamy
Copy link

def calculate_revenue_growth(data, new_discount_age):
original_revenue = 0
new_revenue = 0

for age in data.values():
    if age < 18:
        original_revenue += 5
    else:
        original_revenue += 20
    
    if age < new_discount_age:
        new_revenue += 5
    else:
        new_revenue += 20

growth_percentage = ((new_revenue - original_revenue) / original_revenue) * 100
return growth_percentage

Test data

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
}

Example usage

new_discount_age = 14 # Example input
growth = calculate_revenue_growth(data, new_discount_age)
print(f"Revenue Growth Percentage: {growth:.2f}%")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants