Created
December 2, 2018 19:43
-
-
Save norbinsh/e6b82d0e05e186ece4d152e1944a2de7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
money_dict = {"Group": [[(17100.0, '1.07')], [(-22553.42, '1.07'), (106851.92, '1.07')], [(42000.0, '2')]]} | |
def recursive_tuple(data): | |
class TempBucket: | |
pass | |
bak = TempBucket() | |
bak.bucket = 0 | |
def inner(data): | |
if isinstance(data, list): | |
for item in data: | |
inner(item) | |
else: | |
bak.bucket += data[0] / (float(data[1]) * 12) | |
inner(data) | |
return bak.bucket | |
print(recursive_tuple(money_dict['Group'])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment