Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # coding:utf-8
- """ A module for tests in python fasdkofpdsa """
- def mmc(*args):
- def resolve(d):
- total = 0
- print d.items()
- for key, value in d.items():
- total = key * value
- return total
- mmcs = {}
- for arg in args:
- count = 0
- while arg != 1:
- if arg % 2 == 0:
- arg /= 2
- count += 1
- if 2 in mmcs.keys():
- mmcs[2] = count + 1
- else:
- mmcs[2] = count
- else:
- arg /= 3
- count += 1
- if 3 in mmcs.keys():
- mmcs[3] = count + 1
- else:
- mmcs[3] = count
- return resolve(mmcs)
- def ass_serie(*args):
- return int(sum(args))
- def ass_par(*args):
- mmc_total = mmc(*args)
- ns = []
- for i, arg in enumerate(args):
- ns.append(mmc_total / arg)
- total = (sum(ns))
- return mmc_total / total if mmc_total > total else total / mmc_total
- print("Associacao paralela: ", ass_par(3, 6))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement