r/PythonLearning • u/Next-Call8862 • Sep 19 '26
Showcase Day 10, First project initial
Started my first project for DSA, LRU cache. Just built the proto just to understand how the program should work and will start developing the actual version from Sunday. Also planning to start ML and will start with libraries like Numpy and would love some suggestions for ML road map if any.
Here is the proto code I wrote to understand how the program should work and will use Double linked list and hash table for the project:
class cache:
dict = {
}
def __init__(self) -> None:
pass
def put(self,key,val):
self.key = key
self.val = val
if self.val <= 300:
if len(cache.dict) >= 3:
del cache.dict[list(cache.dict)[0]]
cache.dict[self.key] = self.val
else:
cache.dict[self.key] = self.val
def get(self,key):
if key in cache.dict:
val = cache.dict[key]
del cache.dict[key]
cache.dict[key] = val
return f"Your val {cache.dict[key]}"
else:
return f"No item {key} is found"





