Learn practical skills, build real-world projects, and advance your career

Introduction to Python

Since its first release in 1991, Python has risen to become not just a popular general-purpose programming language, but a preeminent computer language for data science. This notebook is designed to accompany the Datascience network introduction to data science workshop, and it will use Python as the primary means of illustrating data-science tools and resources.

Several examples in this notebook draw from the python.org introductory tutorial and examples given in the Python 3 documentation (with edits and amendments). This introduction to Python is written for Python 3.6.7 but is generally applicable to other Python 3.x versions.

Original material from python.org is Copyright (c) 2001-2019 Python Software Foundation.

This course makes extensive use of Jupyter Notebooks hosted on Microsoft Azure. Azure-hosted Jupyter Notebooks provide an easy way for you to experiment with programming concepts in an interactive fashion that requires no installation of software by students on local computers.

Jupyter Notebooks are divided into cells. Each cell contains either text written in the Markdown markup language or a space in which to write and execute computer code. Because all the code resides inside code cells, you can run each code cell inline rather than using a separate Python interactive window.

> Note: This notebook is designed to have you run code cells one by one, and several code cells contain deliberate errors for demonstration purposes. As a result, if you use the Cell > Run All command, some code cells past the error won't be run. To resume running the code in each case, use Cell > Run All Below from the cell after the error.

Comments

Many of the examples in this notebook include comments. Comments in Python start with the hash character (#) and extend to the end of the physical line. A comment may appear at the start of a line or following white space or code, but not within a string literal. A hash character within a string literal is just a hash character. Because comments are there to clarify code and are not interpreted by Python, they may be omitted when typing in examples. For example:

!pip install jovian
Requirement already satisfied: jovian in c:\users\poorna\anaconda3\lib\site-packages (0.1.82) Requirement already satisfied: requests in c:\users\poorna\anaconda3\lib\site-packages (from jovian) (2.22.0) Requirement already satisfied: pyyaml in c:\users\poorna\anaconda3\lib\site-packages (from jovian) (5.1.1) Requirement already satisfied: uuid in c:\users\poorna\anaconda3\lib\site-packages (from jovian) (1.30) Requirement already satisfied: chardet<3.1.0,>=3.0.2 in c:\users\poorna\anaconda3\lib\site-packages (from requests->jovian) (3.0.4) Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in c:\users\poorna\anaconda3\lib\site-packages (from requests->jovian) (1.25.2) Requirement already satisfied: idna<2.9,>=2.5 in c:\users\poorna\anaconda3\lib\site-packages (from requests->jovian) (2.8) Requirement already satisfied: certifi>=2017.4.17 in c:\users\poorna\anaconda3\lib\site-packages (from requests->jovian) (2019.6.16)
import jovian