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

Function normalize_copy

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

Source from the content-addressed store, hash-verified

90
91print("Example 6")
92def normalize_copy(numbers):
93 numbers_copy = list(numbers) # Copy the iterator
94 total = sum(numbers_copy)
95 result = []
96 for value in numbers_copy:
97 percent = 100 * value / total
98 result.append(percent)
99 return result
100
101
102print("Example 7")

Callers 1

item_021.pyFile · 0.85

Calls 1

appendMethod · 0.45

Tested by

no test coverage detected