# # Complete the 'subscription_summary' function below. # # def subscription_summary(months_subscribed, ad_free_months, video_on_demand_purchases): """ Parameters: months_subscribed: How many months each account purchased. ad_free_months: How many months each account paid for ad free viewing. video_on_demand_purchases: How many Videos on Demand each account purchased. """ print("Welcome to the Ada+ Account Dashboard") # print (months_subscribed) # print (ad_free_months) # print (video_on_demand_purchases) single_month = 7 three_month_bundle = 18 ad_free = 2 video_on_demand = 27.99 #calculating base subscription cost per customer base_subscription_cost = [] for i in range(len(months_subscribed)): if months_subscribed[i] % 3 == 0: three_month_bundle_cost = months_subscribed[i]// 3 * three_month_bundle base_subscription_cost.append(three_month_bundle_cost) elif months_subscribed[i] < 3: single_month_cost = months_subscribed[i]*single_month base_subscription_cost.append(single_month_cost) else: three_month_bundle_cost = months_subscribed[i] // 3 * three_month_bundle three_month_single_cost = months_subscribed[i] % 3 * single_month base_subscription_cost.append(three_month_bundle_cost + three_month_single_cost) print(base_subscription_cost) #calculating ad free cost per customer ad_free_cost = [] for i in range(len(ad_free_months)): ad_free_cost.append(ad_free_months[i]*ad_free) print (ad_free_cost) #calculating video on demand cost per customer video_on_demand_cost =[] for i in range(len(video_on_demand_purchases)): video_on_demand_cost.append(video_on_demand_purchases[i] * video_on_demand) print (video_on_demand_cost) #calculating total subscription cost - includes ad free and video on demand purchases total_subscription_cost = [] for i in range(len(base_subscription_cost)): total_subscription_cost.append(base_subscription_cost[i]+ad_free_cost[i]+video_on_demand_cost[i]) print (total_subscription_cost) if __name__ == '__main__':
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question