Annualised Return

Non-annual Compounding In general, with more than one compounding period in a year, we can express the formula for present value as follows: where m = number of compounding periods per year, RsR_s = quoted annual interest rate, and N = number of years. Annualising Returns A general equation to annualise returns is given, where…

A Basic Python main()

In some python scripts, you may see a function definition and a conditional statement that looks like the example below: In this code, there is a function called main() that prints the phrase “Hello World!” when the Python interpreter executes it. There is also a conditional (or if) statement that checks the value of __name__…

Regular Expressions Based on Syntax Used by Perl

Symbol(s) Meaning Example Example Matches * Matches the preceding character, subexpression, or bracketed character, 0 or more times a*b* aaaaaaaa, aaaaabbbb, bbbbbbb + Matches the preceding character, subexpression, or bracketed character, 1 or more times a+b+ aaaaaab, aaaabbbbb, abbbbbbb [] Matches any character within the brackets (i.e., “Pick any one of these things”) [A-Z]* APPLE,…