Solution
def WACC(price,outstanding,debtValue,debtYield,stockReturn,taxRate):
equity = price*outstanding
total = equity+debtValue
return (equity/total)*stockReturn+(debtValue/total)*debtYield*(1-taxRate)
print(WACC(20.0,100,1000.0,.05,.1,.3))
Source Code