I would like write a python code, with all necessary limits. Say, python code should consume Memory(x MB), Source (y KB) and Time (z Seconds). Can I set these attributes to my code and also log the actual Memory, Source and Time of code along with detailed memory of all objects(size) used in code ? Example Code : <pre lang="Python">def test(n): some_val = 0 some_dict = {} some_list = [] for i in range(n): some_list.append(i) some_dict[i] = i*i print(some_val) print(some_list) print(some_dict) n = int(input()) test(n)
def test(n): some_val = 0 some_dict = {} some_list = [] for i in range(n): some_list.append(i) some_dict[i] = i*i print(some_val) print(some_list) print(some_dict) n = int(input()) test(n)
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)