Recently, I started a FinTech Bootcamp and wanted to share some of the basics I have learned. Python is an important programming language for financial analysis and so much more. To get started you will want to download an application which supports Python and other tools like Pandas. A few I know of are Visual Studio Code and Jupyter Lab.
What is a variable? What is an integer?
original_price = 200
original_price is a variable which represents the number(integer) 200
Integers are important to keep out of quotes because it allows the computer to perform math calculations with the number.
What is a list?
allowance_amounts = [25, 30, 27, 35, 45, 15]
allowance_amounts is the variable which represents the list of allowance amounts. A list uses brackets, [ ], to hold the elements of the list. If the items in the list are words (strings) then they would need quotation marks around each item.
How can we use this list to our advantage? Let's find how many allowances are in the list with the len function.
print(len(allowance_amounts)
= 6
What is a dictionary?
my_dictionary = { "breakfast" : "cereal", "lunch" : "pizza", "dinner" : "steak" }
A dictionary uses a variable like my_dictionary to represent the dictionary and brackets to hold the "key" and "value" pair. "breakfast", "lunch", and "dinner" are all keys while the corresponding food item are the values. In between each key and value pair is a colon ( : ) to tie them together, while each new key pair is separated from the previous with a comma ( , ).
How can we use a dictionary to our advantage? Lets pull the value of the key pair dinner to represent what was eaten for dinner.
print("The food I ate for dinner last night was:")
print(my_dictionary.get("dinner"))
= The food I ate for dinner last night was:
= steak
There is much much more you can do with variables, lists, and dictionaries in python but these are just three easy examples to get a feel for it. A couple really awesome resources I use to help me write or come up with code are GeeksforGeeks and StackOverFlow