1. Introduction to Python for Finance
Hello, and welcome to Introduction to Python for Finance! My name is Adina Howe, and I will be your instructor for this course.
2. Coming up...
In this course, you'll use Python to explore financial data.
You'll be accomplishing this through video lessons, like this one, followed by interactive exercises that will give you a chance to write Python code!
3. Why Python for Finance?
Python is a general-purpose programming language and is easy to learn. Nowadays, you'll find Python being used in practically any piece of software. One reason for this is that it is a glue language, meaning it can easily be used with other programming languages. The use of Python is broad also because its open source, meaning it's free to use. This means anyone can use and share Python code. Finally, Python has become popular as you'll find out shortly because programming in Python is fun!
4. IPython and Scripts in DataCamp Interface
In DataCamp's interface, the IPython Shell is located on the bottom right in the exercises. Consider it a scratch pad to practice code.
In Python, you can also execute the code as a script. Scripts are a set of commands that are executed in the order that they are written. In DataCamp, scripts are written in the upper right corner. All code that is written in DataCamp's script interface is saved automatically.
When you hit "Run Code," the code within the script is executed and you can see the output in the IPython shell, located at the bottom right. When you hit "Submit Answer," your code is not only executed but also checked against the correct solution.
5. Common mathematical operators
You can use Python to perform common mathematical operations such as addition and multiplication. Some of these operators are shown on the slide here.
6. Common mathematical operators
For example, if you want to add 8 to 4, you would use the addition operator as shown here to obtain a result of 12. Similarly, if you want to divide 8 by 4, you would use the division operator (that is the forward slash) to obtain the result of 2.
To generate an output of a script, you have to explicitly use the print command. If you do not specify the print command in this script, no output would be displayed.
7. Any comments?
You may have noticed lines of code that started with a hashtag symbol. In Python, this symbol as the first character in a line indicates that the line is a comment.
A comment is an annotation to the code that makes the code easier to understand and offers information to others reading the code.
8. Let's practice!
Now that you've learned about the IPython interface and scripts, let's practice writing your first Python commands and getting more familiar with the DataCamp interface.