官术网_书友最值得收藏!

Using IPython

For a Windows version, after navigating to Anaconda3 from All Programs and then clicking on IPython, we can see the following:

You can also do the the same by launching Anaconda Prompt and then typing ipython

This tells us that the version of Python is 3.6.3 and that the version of IPython is 6.1.0. We could type a few commands to test it. For example, if we invest $100 today for an investment horizon of 5 years, and the annual return is 10%, what is our expected future value? The future value formula for a given present value is provided here:

where FV is the future value, PV is the present value, R is the period return, and n is the number of periods:

The first line of command of pv=100 assigns a value of 100 to pv. For the fifth line, we typed a command line of pv*(1+r)^n. However, we received an error message of TypeError: unsupported operand type(s) for ^: 'float' and 'int'. The error message tells us that Python does not recognize the operand of ^ for a power. The corresponding operation for a power is double multiplication, as in **. There is also  a power() function similar to **, shown here:

主站蜘蛛池模板: 新兴县| 乐陵市| 忻州市| 四子王旗| 龙江县| 宜城市| 佛冈县| 西乌珠穆沁旗| 长葛市| 精河县| 文成县| 鄱阳县| 义乌市| 财经| 洛扎县| 清苑县| 台山市| 蓬安县| 安化县| 忻州市| 沁阳市| 华宁县| 迁安市| 巴青县| 磐安县| 乡宁县| 外汇| 武隆县| 策勒县| 茂名市| 阳江市| 家居| 城市| 蕉岭县| 友谊县| 石阡县| 昌江| 阳朔县| 张家界市| 崇礼县| 桃江县|