Saturday, October 22, 2022

My Python in practice 20221022

My Python in practice 20221022

My wee Python programming to simulate Money Supply ⇒ Interest Rate ⇒ Investment volume. I am practising with applying my Python lesson to some sort of simulation modelling instead of just memorising it!

def Y_Inv(MS,Y):
    r_MS=pow(MS/10,-1.05)
    return pow(Y,-1*(r_MS))

for MS in range(1,100):
    print(Y_Inv(MS,100))

 

The followings are the breakdowns: 

 

# Liquidity(Money Supply) where Money Supply is i in range ():
def r_MS(MS):
    return pow(MS/10,-1.05)

for i in range(1,100):
    print(r_MS(i))



# Liquidity(Money Supply) where Interest Rate on Money Supply = Liquidity is i in range () WITH GENERATOR:

def r_MS(MS):
    yield pow(MS/10,-1.05)

for i in range(1,100,10):
    print(r_MS(i))

next(r_MS(i))


# Lambda function example of Interest Rate on Money Supply and Income of Investment on Interest Rate (on Money Supply = Liquidity) and Income fixed:

r_MS= lambda MS: pow(MS/10,-1.05)
Y_inv = lambda MS,Y : pow(Y,-1*(r_MS(MS)/10))

print("Interest Rate by Money Supply is", r_MS(100))
print("Income by investment is", Y_inv(100,100))



# Higher function of Income of Investment on the Interest Rate on Money Supply = Liquidity:

def Y_Inv(MS,Y):
    r_MS=pow(MS/10,-1.05)
    return pow(Y,-1*(r_MS))

Y_Inv(100,100)



# Income of Investment on the Interest Rate on Money Supply = Liquidity

def Y_Inv(MS,Y):
    r_MS=pow(MS/10,-1.05)
    return pow(Y,-1*(r_MS))

for MS in range(1,100):
    print(Y_Inv(MS,100))

 

# Income of Investment on the Interest Rate on Money Supply = Liquidity WITH GENERATOR:

def Y_Inv(MS,Y):
    r_MS=pow(MS/10,-1.05)
    yield pow(Y,-1*(r_MS))
    
for MS in range(1,100,10):
    x = (Y_Inv(MS,100))
    print(x)

next(x)


My Python in practice 20221023

I practised Python dictionary function with the character-status of Romancing Saga 3 characters (See My Python in practice 20221023)

 

 

 

 

 

 

 

 

 

 

 

No comments: