+ 3
Python for Finance Code Repo 10.2
When I select run, it does not show me if I did the code correctly, the screen just flashes. This is what I did: (ps. on pc, I did not see an option to add my code elsewhere, like on my tablet) import numpy as np import numpy_financial as npf #price for 2018-2021 bitcoin = [3869.47, 7188.46, 22203.31, 29391.78] an_array = np.array(bitcoin) multiplied_array = an_array * 10 print(multiplied_array) mining_array = [-500000, 38694.7, 71884.6, 222033.1, 293917.8] npf.irr(mining_array)
9 Respuestas
+ 5
Stacey Prahl , Rik Wittkopp ,
Stacey, did you get an error message by running the code???
i have taken a look at the code of 10.2, but could not find an issue. the final print statement is not done there, may be this causes an error.
but i found a typo in the code of 11.2 code (plotting):
bitcoin_newValue = np.mulitply(bitcoin, bitcoin_owned), but has to be ...multiply(...)
please correct this, it should work properly...
+ 3
Lothar
Since you have pro & have completed the Python for Finance course, could you help Stacey Prahl with this problem.
0
Stacey Prahl
I get a result for the existing print line, and another result when I print the last line.
import numpy as np
import numpy_financial as npf
#price for 2018-2021
bitcoin = [3869.47, 7188.46, 22203.31, 29391.78]
an_array = np.array(bitcoin)
multiplied_array = an_array * 10
print(multiplied_array)
mining_array = [-500000, 38694.7, 71884.6, 222033.1, 293917.8]
print(npf.irr(mining_array))
0
I took out the additional code from 11.2, and ran it again. This is what I got for a result:
[38694.7 71884.6 222033.1 293917.18]
0
My code Repo symbol omly shows 1/2 a diamond, which seems to me that I'm only half right.
0
https://code.sololearn.com/cFLfc03f5mvs/#py
Here is my updated code
0
I had forgotten to add print before npf.irr(mining_array)
to be print(npf.irr(mining_array))
but I still did not get the same answer as the expected result.
0
I did not get the expected result" 0.0729721591 after adding the print() before the npf...))
0
it looks like your initial investment price is wrong, you have 50k instead of 500k and remove the first print statement the rest of the code looks fine.