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

Function parse_memory

sorts/external-sort.py:129–137  ·  view source on GitHub ↗
(string)

Source from the content-addressed store, hash-verified

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

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected