Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 30

Workshop on

“Machine Learning: Practical Approach


for beginners”
Basics of Python
By
Dr. Prashant Singh Rana
Computer Science & Engineering Department,
Thapar Institute of Engineering and Technology,
Patiala, Punjab.
09-10 Aug 2020
Day 2
Outline
1. Download & Install Anaconda for Python
2. Learn Basics of Python
3. Conditional Statements in Python
4. Loops of Python
5. Libraries in Python
Sub Set Problem 1
Problem Statement
Find all the subset from a set of
numbers whose sum is zero.
Constraint: Subset size must be 5.
A={-12,-3,-6,7,2,-2,6,3,9,-7,-5,-
8,1,11,-9,-4}
Sub Set Problem 1
Random Approach (Brute Force)

Select Random Set of size 5

Calculate sum
Yes
If SUM is 0 Save set in list
No

No Yes
Termination
Condition Return list of sets
Sub Set Problem 2
Problem Statement
Find all the subset from a set of
numbers whose sum is zero.
Constraint: Subset size must be 3
to 6 only.
A={-12,-3,-6,7,2,-2,6,3,9,-7,-5,-
8,1,11,-9,-4}
Application of
Sub Set Problem ???
Application of
Sub Set Problem ???
Finding Combo Offer by online portal
e.g. – Flipcart, Amazon, Snapdeal, etc.
Project - 1
ComboFinder
Web application to find combo offer.
Input Output

{P2,P5,P7}
upload {P1,P3,P6,P7}
{P2,P6,P9}
{P3,P7,P9,P12}

Product Sets

Product List
Project - 1
ComboFinder
Develop Web Interface

File Name Browse File....

Lower Limit 490 Upper Limit 510


Email Id psrana@gmail.com

Submit
Download Python
Download and Install Python

1. Go to Google and search “python”


www.python.org

2. Go to Google and search “Anaconda”


www.anaconda.com
Python IDE
1. Python default IDE is ‘IDLE”
2. Spyder
3. Jupyter Notebook
4. PyCharm
5. ……… Many More
Python Online IDE
1. Google Colab
2. IDEOne
3. Programiz
4. OnlineGDB
5. ……. Many More
To start Python IDE
Open “Anaconda Prompt”
Start  Anaconda
To start Python IDE
Write on cmd line  idle
Working with Python IDE
To start Python IDE
Click on File  New File
Write first python program in the file
Save and run (F5)
Working with Spyder
Click on Start and Write  Spyder
Working with Spyder
Click on Start and Write  Spyder
Write python program in file, save and run (F5)
Working with Jupyter Notebook
Open Jupyter  Method 1
Click on Start and Write  Jupyter Notebook
Working with Jupyter Notebook
Open Jupyter  Method 2
Click on Start and Write  Anaconda Navigator
 Launch Jupytor
Working with Jupyter Notebook
1. Click on Start and Write  Jupyter Notebook
Jupyter will open in Brower
Working with Jupyter Notebook
1. Click on Start and Write  Jupyter Notebook
Jupyter will open in Brower
Click on  New  Python 3
Working with Jupyter Notebook

To execute cell  press “ctrl + enter”


Working with Google Colab
Go to  bit.ly/git2020-python
Download and Store in local machine
Working with Google Colab
Go to  bit.ly/git2020-python
Right Click Day02 file  Open with  Google
Colab
If Google Colab is not visible  “Connect more
apps”  search for “colab”  “Install”
Working with Google Colab
Go to  bit.ly/git2020-python
Right Click Day02 file  Open with  Google
Colab
To run each cell  press “ctrl + enter”
Working with Jupyter Notebook
How to access/open Jupyter notebook if store in
different Drive
Open Anaconda command prompt
Go to drive (e.g. f: )
Write “jupyter notebook” and browse
notebook
Install Python Package
Two ways to install  pip or conda
 Go to Anaconda Prompt and write 
pip install <packageName>
conda install <packageName>
Thanks
Learning by Doing

psrana@gmail.com

You might also like