MCPcopy Index your code
hub / github.com/TheAlgorithms/Python / parse_memory

Function parse_memory

sorts/external_sort.py:128–136  ·  view source on GitHub ↗
(string)

Source from the content-addressed store, hash-verified

126
127
128def parse_memory(string):
129 if string[-1].lower() == "k":
130 return int(string[:-1]) * 1024
131 elif string[-1].lower() == "m":
132 return int(string[:-1]) * 1024 * 1024
133 elif string[-1].lower() == "g":
134 return int(string[:-1]) * 1024 * 1024 * 1024
135 else:
136 return int(string)
137
138
139def main():

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected