import os family_plan = {"Darshana": 51.67, "Hari-wife": 45.55, "Hari": 20.42, "Deepesh": 47.51, "Divya": 45.42, "Yuvika": 20.42 } data_charge = 125.50 bill_charge = 397.48 total_members = len(family_plan) def calculate_individual_costs(): total = 0 for member in family_plan: family_plan[member] += data_charge/total_members print("%s: %0.02f" % (member, family_plan[member])) total += family_plan[member] print("Bill:%0.02f total:%0.02f" % (bill_charge, total)) calculate_individual_costs()
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