a guest Jan 20th, 2019 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- PriceList = 
- N = eval(input("請輸入計算次數:"))
- Weight = (2 / (N + 1))
- for i in range(1,N+1):
- PriceNum = "請輸入第"+str(i)+"次的近期價格:"
- Price = eval(input(PriceNum))
- EMAPrice = (Price * ((1 - Weight) ** (i - 1)))
- EMA = (Weight * sum(PriceList))
- print("EMA = ",EMA)
RAW Paste Data