task3 #2

Merged
schmidmarco merged 40 commits from task3 into main 2026-03-13 10:11:18 +01:00
Showing only changes of commit ffc1c06a2d - Show all commits

View File

@ -0,0 +1,27 @@
from abc import ABC, abstractmethod
class Storage(ABC):
@abstractmethod
def save(self, key: str, value: str) -> None:
pass
@abstractmethod
def load(self, key: str) -> str:
pass
class MemoryStorage(Storage):
def __init__(self) -> None:
self.storage = {}
def save(self, key: str, value: str) -> None:
self.storage[key] = value
def load(self, key):
return self.storage[key]
s = MemoryStorage()
s.save("randomkey", "My Value")
print(s.load("randomkey"))