Python is a general purpose programming language that supports rapid development of scripts and applications.
Python's main advantages:
Created by Guido van Rossum around 1991.
In [1]:
# can you guess what this code is doing?
def print_sum(x, y):
z = x + y
print(z)
The code is well structured and as you can see we don't use curly brackets ({}) around the code as in other languages. Python uses indentation.
Python is also dynamic, it means that we don't have to declare our variables before using them.
Python is an interpreted language. As a consequence, we can use it in two ways:
user:host:~$ python
Python 3.5.1 (default, Oct 23 2015, 18:05:06)
[GCC 4.8.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> message = "Hello World"
>>> print(message)
Hello World
*.py
extension:Create a file called hello.py
and put this text inside:
# Output should be 'Hello there'
message = "Hello World"
print(message)
Then from the terminal (or powershell if you use windows) type:
python hello.py
The advanced calculator
is called REPL, Read Evaluate Print Loop
As you can see the result is the same, we printed the variable called message.
Jupyter is the new name for what once called IPython Notebook. The name has 2 purposes:
notebook
wrote by Galileo Galileo in which data and analysis are put together, in the first notebook
Galileo Galilei was studying JupiterJupyter today is a big collection of projects, including Jupyter Notebook, JupyterHub, the new JupyterLab and many others.
Jupyter notebook brings an enchanced REPL experience inside your browser, basically you can run Python commands from your browser and Jupyter Notebook will take care of execute them. Under the hood this process is done by the Jupyter Notebook, a communication protocol and a kernel (generally IPython)
Jupyter provides a convenient platform to learn coding.
It uses a browser, something we are all very comfortable with, to edit and run your code.
It's also a widely used library inside the Python and Data community.
To run jupyter you need to open the terminal/console and type:
jupyter-notebook
or
jupyter notebook
If you have a notebook open you should see a top menu (File, Edit, View...) a series of buttons under it (floppy disk, plus, scissor...)
Try to use the advanced calculator
(REPL) if you get stuck in and you want to exit you need to type exit()
Is there something that surprises you?