Exercises
- Where can you download and install Python?
- Is Python case-sensitive?
- How do you assign a set of values to pv in the format of a tuple. Could we change its values after the assignment?
- Estimate the area of a circle if the diameter is 9.7 using Python.
- How do you assign a value to a new variable?
- How can you find some sample examples related to Python?
- How do you launch Python's help function?
- How can you find out more information about a specific function, such as
print()
? - What is the definition of built-in functions?
- Is
pow()
a built-in function? How do we use it? - How do we find all built-in functions? How many built-in functions are present?
- When we estimate the square root of 3, which Python function should we use?
- Assume that the present value of a perpetuity is $124 and the annual cash flow is $50; what is the corresponding discount rate? The formula is given here:
- Based on the solution of the previous question, what is the corresponding quarterly rate?
- For a perpetuity, the same cash flow happens at the same interval forever. A growing perpetuity is defined as follows: the future cash flow is increased at a constant growth rate forever. If the first cash flow happens at the end of the first period, we have the following formula:
Here PV is the present value, C is the cash flow of the next period, g is a growth rate, and R is the discount rate. If the first cash flow is $12.50, the constant growth rate is 2.5 percent, and the discount rate is 8.5 percent. What is the present value of this growing perpetuity?
- For an n-day variance, we have the following formula:
Here is the daily variance and is is the daily standard deviation (volatility). If the volatility (daily standard deviation) of a stock is 0.2, what is its 10-day volatility?
- We expect to have $25,000 in 5 years. If the annual deposit rate is 4.5 percent, how much do we have to deposit today?
- The substitution function called
sub()
is from a Python module. Find out how many functions are contained in that module. - Write a Python program to convert the standard deviation estimated based on daily data or monthly data to an annual one by using the following formulas:
- The Sharpe ratio is a measure of trade-off between benefit (excess return) and cost (total risk) for an investment such as a portfolio. Write a Python program to estimate the Sharpe ratio by applying the following formula:
Here is the portfolio mean return, is the mean risk-free rate and σ is the risk of the portfolio. Again, at this moment, it is perfectly fine that a reader does not understand the economic meaning of this ratio since the Sharpe ratio will be discussed in more detail in Chapter 7, Multifactor Models and Performance Measures.