F = {}
class T:
    def __init__(L, R, Q, S):
        L.R = R
        L.Q = Q
        L.S = S
    
    def Rem(L):
        F[f"{L.R}"] = (f"{L.Q}") 
        return f"{L.R}→{L.Q},add"
    
    def Cst(L):
        print(L.S)
        return f"{F[L.S]}"

# いろいろな年齢の犬を作ってみる
dog1 = T("Hello", "Hello", "Hello")      
Y=dog1.Rem()
print(dog1.Cst())  # 「私はポチ、3歳です!」

dog1 = T("What's there?", "There is a pen", "")  
Y=dog1.Rem()
dog1 = T("How are you?", "I'm happy", "What's there?") 
print(dog1.Cst())  # 「私はポチ、3歳です!」

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: