Inroduction to Python

Python can be classified as a scripting language, similar to languages like JavaScript and Pearl. Python code can be written in many styles, including functional, imperative, object oriented and procedural. As such, Python is a very power and expressive language. It is also very simple and easy to learn. The language is very English-like, in a sense that there isn't a lot of jargon and complex syntax to learn. Essentially, you can code as you would normally talk or think about what your program is supposed to do. This is one reason why it is used by many disciplines outside of computer science. The links below contain various sources, both free and paid, supplemental to course material.

How to install Python

We will be working with Python 3. There are many sources of code and programs that still utilize Python 2.7, but this is outdated and has some downfalls. To download Python 3, simply go to the Python download page and download the latest installer for your operating system (version 3.5 or higher will be sufficient). When installing, specifacally for windows, make sure you do not install it underneith program files, otherwise you can run into issues installing packages. Install it in the root of your 'C' drive, for example, mine is installed under 'C:\Python36'.

What is this fancy notebook you are using?

You may or may not have been asking this question, but this page was created using Jupyter. I would equate Jupyter to something like a blog or OneNote/Evernote, but for programming. You can create beautiful HTML using markdown, embed media, and most importantly, write code. This can all be embedded into a webpage, or exported for offline use. Please read/watch the following materials to install and learn more about Jupyter:

In [2]:
"Hello World!"
Out[2]:
'Hello World!'
In [3]:
print("Hello World!")
Hello World!
In [4]:
print("Python is pretty easy")
Python is pretty easy
In [5]:
print("This is a basic example on how to print")
This is a basic example on how to print
In [6]:
print("I am on one line\n now im on another")
I am on one line
 now im on another
In [7]:
print("You can\ttab too!")
You can	tab too!
In [8]:
print('I don't think this will work.'')
  File "<ipython-input-8-d9fd423c150d>", line 1
    print('I don't think this will work.'')
                 ^
SyntaxError: invalid syntax
In [9]:
print('"This" one doesn't work either)
  File "<ipython-input-9-7454d54165ba>", line 1
    print('"This" one doesn't work either)
                            ^
SyntaxError: invalid syntax
In [10]:
print("This statement won't throw an error")
This statement won't throw an error
In [11]:
print("But this "quote" does")
  File "<ipython-input-11-b56962ad3f7f>", line 1
    print("But this "quote" does")
                         ^
SyntaxError: invalid syntax
In [13]:
5+5
Out[13]:
1.6666666666666667
In [14]:
5-2
Out[14]:
3
In [15]:
4/2
Out[15]:
2.0
In [16]:
3/5
Out[16]:
0.6
In [17]:
1/3
Out[17]:
0.3333333333333333
In [18]:
1//3
Out[18]:
0
In [19]:
16/5
Out[19]:
3.2
In [20]:
16%5
Out[20]:
1
In [21]:
15%5
Out[21]:
0
In [22]:
5*5
Out[22]:
25
In [23]:
5**5
Out[23]:
3125
In [24]:
1 + 2 * 2
Out[24]:
5
In [25]:
(1 + 2) * 2
Out[25]:
6
In [26]:
5 / 2 + 3
Out[26]:
5.5
In [27]:
5 / ( 2 + 3)
Out[27]:
1.0
In [28]:
1 / 4 * 100
Out[28]:
25.0
In [29]:
1 // 4 * 100
Out[29]:
0
In [30]:
import math
math.log(5)
Out[30]:
1.6094379124341003
In [31]:
math.sin(1)
Out[31]:
0.8414709848078965