MCPcopy Create free account
hub / github.com/bslatkin/effectivepython / normalize

Function normalize

example_code/item_021.py:51–57  ·  view source on GitHub ↗
(numbers)

Source from the content-addressed store, hash-verified

49
50print("Example 1")
51def normalize(numbers):
52 total = sum(numbers)
53 result = []
54 for value in numbers:
55 percent = 100 * value / total
56 result.append(percent)
57 return result
58
59
60print("Example 2")

Callers 1

item_021.pyFile · 0.85

Calls 1

appendMethod · 0.45

Tested by

no test coverage detected