Programming Basics and Data Analytics
with Python
Programming Environment Setup
Learning Objectives
By the end of this lesson, you will be able to:
Define Python and its features
List the frequently used libraries in Python
Describe Anaconda and its uses
Download and set up Python console
Python
What Is Python?
Python is a high-level, interpreted, object-oriented programming language. It was created by Guido van
Rossum in 1991. Python is used for tasks like web development, scripting, web scraping, and data analytics.
Features of Python
Easy-to-learn Interactive mode Portable Extendable
Free and open
GUI programming Integrated
source
Characteristics of Python
• Supports functional and structured programming methods as well as OOP
• Can be used as a scripting language or can be compiled to bytecode for building large
applications
• Provides high-level dynamic data types and supports dynamic type checking
• Supports automatic garbage collection
• Can be integrated with C, C++, COM, ActiveX, CORBA, and Java
Benefits of Python
Interactive
Interpreted Object-Oriented
Applications of Python
Python is simple and has easy to learn syntax that emphasizes readability.
It supports modules and packages that encourage program modularity and code reuse.
Application:
1. Web Development and GUI Programming
2. Machine Learning
3. Data Analytics
4. Artificial Intelligence
5. Internet of Things
Frequently Used Libraries in Python
Environments for Python
Environments for Python
Python has both basic and scientific learning environments called IDLEs (Integrated Development
and Learning Environment) where code is written and outputs are checked.
Python
Scientific Basic
Jupyter Command
PyCharm Spyder GUI
Notebook Line
Anaconda
What Is Anaconda?
Anaconda is a free and open-source distribution of Python and R programming languages for
scientific computing (data science, machine learning applications, large-scale data processing, and
predictive analytics) that aims at simplifying package management and deployment.
Why Anaconda?
It is recommended to download Anaconda in order to use Python.
Advantages of Anaconda:
Open-source Python
distribution
400+ Python packages
Enterprise-ready data
analytics platform
Modern data science analytics
architecture
Multi-workload data analytics
Interactive visualizations, governance,
security, and operational support
Big data environments
Installation of Anaconda Python Distribution
Installation of Anaconda Python Distribution
Python 2.7 and Python 3.7 are the two versions of Python.
However, Python 3.7 is the most recent and preferable version.
Note: Though the latest version of Python is 3.8, the latest version available in Anaconda is 3.7.
The configurations are the same for both versions.
Installation of Anaconda Python 3.7 Distribution
You can install and run the Anaconda Python 3.7 distribution on different platforms.
Windows macOS Linux
Website URL:
https://www.anaconda.com/distribution
Graphical Installer
• Download the graphical installer.
• Double-click the .exe file to install Anaconda
and follow the instructions on the screen.
Installation of Anaconda Python 3.7 Distribution
Windows macOS Linux
Website URL:
https://www.anaconda.com/distribution/
Graphical Installer
• Download the graphical installer.
• Double-click the downloaded .pkg file and follow the
instructions.
Command Line Installer
• Download the command line installer.
• In your terminal window, type the command listed
below and follow the given instructions:
Python 3.7:
bash Anaconda2-4.0.0-macOSX-x86_64.sh
Installation of Anaconda Python 3.7 Distribution
Windows macOS Linux
Website URL:
https://www.anaconda.com/distribution/
Command Line Installer
• Download the installer.
• In your terminal window, type the command line
shown below and follow the instructions:
Python 3.7:
bash Anaconda2-4.0.0-Linux-x86_64.sh
Jupyter Notebook
Jupyter Notebook
Jupyter is an open-source and interactive web-based Python interface for data
science and scientific computing.
Advantages of Jupyter Notebook
Python language Content sharing and
support contribution
Big data platform Built-in interactive
integration widgets
Getting Started with Jupyter Notebook
Import sys module
Print sys version
Import platform library
View python version
Comment line
Test string
Test number operation
Install Python
Problem Statement: A software developer at a company is required to install Python and Anaconda on his or
her local system.
Steps to Perform:
1. Download Python
2. Click on Install Now
3. Download Anaconda
4. Click the Next button to start the installation
5. Click the Install button for installing Anaconda
6. Click the Finish button to complete the installation
First Python Program
Problem Statement: Write a simple Python program to print a string of characters, an integer value, and a float
value.
Steps to Perform:
1. Declare variables as integer value, float value, and string
2. Print the variables
Knowledge Check
Knowledge
Check Jupyter is not an open-source and interactive web-based Python interface for data
science and scientific computing.
1
a. True
b. False
Knowledge
Check Jupyter is not an open-source and interactive web-based Python interface for data
science and scientific computing.
1
a. True
b. False
The correct answer is b
Jupyter is an open-source and interactive web-based Python interface for data science and scientific
computing.
Knowledge
Check
Which of the following commands helps to print the version of Anaconda in Python?
2
a. --version
b. sys.version
c. print version
d. print sys.version
Knowledge
Check
Which of the following commands helps to print the version of Anaconda in Python?
2
a. --version
b. sys.version
c. print version
d. print (sys.version)
The correct answer is d
The command print sys.version helps to print the version of Anaconda in Python.
Knowledge
Check
Which of the following is NOT an appropriate way to print in Python?
3
a. Print (‘Hi’)
b. Print (“Hi”)
c. Print Hi
d. All of the above
Knowledge
Check
Which of the following is NOT an appropriate way to print in Python?
3
a. print (‘Hi’)
b. print (“Hi”)
c. Print Hi
d. All of the above
The correct answer is D
Print Hi is not an appropriate way to print in Python.
Key Takeaways
Python is a high-level, interpreted, object-oriented
programming language
The frequently used libraries in Python are Numpy, Pandas,
Scipy, Matplotlib, and Scikit-learn.
Anaconda is the open source free distribution of Python.
Jupyter is an open-source and interactive web-based Python
interface for data science and scientific computing.