SlideShare a Scribd company logo
Python:
Basics (in Python)
AAA-Python Edition
Plan
●
1- Basic Operations and variables
●
2- Basic Types
●
3- Functions and white space formatting
●
4- Modules and Libraries
●
5- Examples of some Libraries
●
6- Installing Libraries in Google Colab
3
1-BasicOperations
Andvariables
[By Amina Delali]
●
To perform simple operations, you just have to type them:
Integer division/floored quotient
Modulus (remainder)
Exponent
4
1-BasicOperations
Andvariables
[By Amina Delali]
●
Other type of operations:
If 5 wasn’t greater
than 3, it would returned
False
Is 5 different
from 3
Is 5 equal to 3
The only case this expression is evaluated to False,
it’s when the two operands are evaluated to False
The only case this expression is evaluated to True,
it’s when the two operands are evaluated to True
5
1-BasicOperations
Andvariables
[By Amina Delali]
●
Table of precedence of some operators (increasing order)
To evaluate an expression with multiple operators,the “precedence” rule apply
Expression between parentheses is evaluated first:(-1+1)=0
Then the exponentiation is evaluated: 6**0=1
Then the multiplication is evaluated: 3*1=3
Then the addition is evaluated: 5+3=8
The full table can be seen at:
https://docs.python.org/3.6/reference/expressions.html#operator-precedence
or
and
not
< , <= , > ,
>= , != , ==
+, -
* , / , // , %
**
( )
Highest precedence
Operators in the same box
have same precedence
Operators in the same box group from left to right
(except for exponentiation **).For example, to evaluate 5 / 4 * 2 :
We start by: 5 / 4 = 1.25 (the most left operator)
Then: 1.25 * 2 = 2.5 (we continue with the following one)
6
1-BasicOperations
Andvariables
[By Amina Delali]
●
We can store values of expressions in “variables” with the
“assignment” statement:
Assignment statement
Variable name
●
Variable names have some mandatory characteristics
●
Composed of 1 word
●
Composed only by: letters, number or the
underscore character (_)
●
Can not start with a number
The value of “a” is 3,
and the value of “b” is 5
7
1-BasicOperations
Andvariables
[By Amina Delali]
●
We can assign one value to multiple variables
●
We can assign multiple values to multiples variables:
8
2-BasicTypes
[By Amina Delali]
● Numbers
●
Integer 5
-3
0
1000
●
Float 7.8
-3.156
0.0
●
Complex 5.3+2j
10+1J
●
A number can be:
Real part
Imaginary part
9
2-BasicTypes
[By Amina Delali]
Strings
●
String are text values written between quotes:
10
2-BasicTypes
[By Amina Delali]
Strings
●
With Strings, we can perform Concatenation and
Replication operations:
11
2-BasicTypes
[By Amina Delali]
●
Boolean
●
They have only two values: True and False
●
In a numeric context: True behaves like 1 and False like 0
●
The Boolean operators are : and, or, not
12
3-Functionsand
whitespace
formatting
[By Amina Delali]
●
Functions are a “reusable” block of code.
●
They can be “built-in” functions: already defned
●
They can be also “user-defned”: you can defne your own
functions.
●
Example of built-in functions:
Functions
Number of character of
string S1
13
3-Functionsand
whitespace
formatting
[By Amina Delali]
Functions
Convert j into a float
New line character
14
3-Functionsand
whitespace
formatting
[By Amina Delali]
User defined functions
White space formatting
●
Python uses indentation to define blocks of code
●
Blocks begin when the indentation increases
●
Blocks end when the indentation decreases
●
Whitespace is ignored inside parentheses and brackets
The block of code
is marked by a colon(:)
and its indentation
(the space before print)
Calling the function
(decreasing the indentation to terminate
The function definition block)
15
3-Functionsand
whitespace
formatting
[By Amina Delali]
●
Return statement
The function arguments
Keyword and default arguments
●
A function can return a value using the keyword “return”
The function returns the value
of a+b
●
In a function call, we can identify the arguments by their name.
●
In a function definition, the arguments can have a default value
they will be optional
16
3-Functionsand
whitespace
formatting
[By Amina Delali]
●
The default value of a third argument
So the argument is optional
The order of the arguments a and b
doesn’t matter, since they are identified
by their names
17
4-ModulesandLibraries
[By Amina Delali]
●
A module is a program that contains a related group of functions that can
be embedded in your programs
Module and Library
●
To use the functions module you have to use the “import” statement.
●
Other statement with import like “from” and “as” can be used
●
A set of modules define a Library
●
Python comes with a library called the standard library
●
To use an other library modules, you have to install the corresponding
library : a third-party library
18
4-ModulesandLibraries
[By Amina Delali]
Function “randint “from
module random
Only “randint” was
imported
The name of “randint” was replaced by “ri”
19
5-Examplesofsome
Libraries
[By Amina Delali]
● Third-party libraries
●
Numpy: is the fundamental package for scientific computing with
Python
●
Pandas: is an open source, BSD-licensed library providing high-
performance, easy-to-use data structures and data analysis tools for the
Python programming language.
●
Matpolotlib: is a Python 2D plotting library
●
Tensorflow: An open source machine learning framework for
everyone. It is a software library for high performance numerical
computation.
20
5-Examplesofsome
Libraries
[By Amina Delali]
●
Third-party libraries
●
Numpy:
21
5-Examplesofsome
Libraries
[By Amina Delali]
●
Third-party libraries
●
Matplotlib:
22
6-InstallingLibraries
inGoogleColab
[By Amina Delali]
! pip install
apt-get
After !apt-get update
From:( https://colab.research.google.com/notebooks/snippets/importing_libraries.ipynb)
References
●
Duchesnay Edouard and Löfstedt Tommy.Statistics and machine learning in python
release 0.2. On-line at ftp:
//ftp.cea.fr/pub/unati/people/educhesnay/pystatml/M1_IMSV/
StatisticsMachineLearningPythonDraft.pdf. Accessed on 23-09-2018.
●
Python Software Foundation. The python language reference. On-line
at https://docs.python.org/3.6/reference/index.html. Accessed on 23-09-2018.
●
Python Software Foundation. The python standard library. On-line at
●
https://docs.python.org/3.6/library/index.html. Accessed on 23-09-2018.
●
Joel Grus. Data science from scratch: frst principles with python. O’Reilly Media,
Inc, 2015.
●
J. D. Hunter. Matplotlib: A 2d graphics environment. Computing In Science &
Engineering, 9(3):90–95, 2007.
●
NumPy. Numpy. On-line at http://www.numpy.org/. Accessed on 23-09-2018.
References
●
pandas. pandas. On-line at https://pandas.pydata.org/. Accessed on
23-09-2018.
●
Chandat Sunny. Learn Python in 24 Hours. CreateSpace Independent
Publishing Platform, 2016.
●
Al Sweigart. Automate the boring stuf with Python: practical programming
for total beginners. No Starch Press, 2015.
●
TensorFlow. About tensorfow. On-line at https://www.tensorfow.
org/. Accessed on 23-09-2018.
RuleN°7
Thank
you!
FOR ALL YOUR TIME

More Related Content

What's hot (20)

Function in C Programming
Function in C ProgrammingFunction in C Programming
Function in C Programming
Anil Pokhrel
 
Java 8 Lambda Expressions & Streams
Java 8 Lambda Expressions & StreamsJava 8 Lambda Expressions & Streams
Java 8 Lambda Expressions & Streams
NewCircle Training
 
Functional programming in scala
Functional programming in scalaFunctional programming in scala
Functional programming in scala
Stratio
 
Intro to JavaScript - Week 2: Function
Intro to JavaScript - Week 2: FunctionIntro to JavaScript - Week 2: Function
Intro to JavaScript - Week 2: Function
Jeongbae Oh
 
Python recursion
Python recursionPython recursion
Python recursion
Prof. Dr. K. Adisesha
 
Functional Programming in Ruby
Functional Programming in RubyFunctional Programming in Ruby
Functional Programming in Ruby
Alex Teut
 
Dev Concepts: Functional Programming
Dev Concepts: Functional ProgrammingDev Concepts: Functional Programming
Dev Concepts: Functional Programming
Svetlin Nakov
 
Function & Recursion
Function & RecursionFunction & Recursion
Function & Recursion
Meghaj Mallick
 
Java 8 Functional Programming - I
Java 8 Functional Programming - IJava 8 Functional Programming - I
Java 8 Functional Programming - I
Ugur Yeter
 
Function
FunctionFunction
Function
jasscheema
 
Python algorithm
Python algorithmPython algorithm
Python algorithm
Prof. Dr. K. Adisesha
 
Functional go
Functional goFunctional go
Functional go
Geison Goes
 
Functions in C
Functions in CFunctions in C
Functions in C
Kamal Acharya
 
Functional programming
Functional programmingFunctional programming
Functional programming
Kibru Demeke
 
VIT351 Software Development VI Unit1
VIT351 Software Development VI Unit1VIT351 Software Development VI Unit1
VIT351 Software Development VI Unit1
YOGESH SINGH
 
Ruby Functional Programming
Ruby Functional ProgrammingRuby Functional Programming
Ruby Functional Programming
Geison Goes
 
user defined function
user defined functionuser defined function
user defined function
King Kavin Patel
 
Python functional programming
Python functional programmingPython functional programming
Python functional programming
Geison Goes
 
Think in linq
Think in linqThink in linq
Think in linq
Sudipta Mukherjee
 
Introduction to functional programming (In Arabic)
Introduction to functional programming (In Arabic)Introduction to functional programming (In Arabic)
Introduction to functional programming (In Arabic)
Omar Abdelhafith
 
Function in C Programming
Function in C ProgrammingFunction in C Programming
Function in C Programming
Anil Pokhrel
 
Java 8 Lambda Expressions & Streams
Java 8 Lambda Expressions & StreamsJava 8 Lambda Expressions & Streams
Java 8 Lambda Expressions & Streams
NewCircle Training
 
Functional programming in scala
Functional programming in scalaFunctional programming in scala
Functional programming in scala
Stratio
 
Intro to JavaScript - Week 2: Function
Intro to JavaScript - Week 2: FunctionIntro to JavaScript - Week 2: Function
Intro to JavaScript - Week 2: Function
Jeongbae Oh
 
Functional Programming in Ruby
Functional Programming in RubyFunctional Programming in Ruby
Functional Programming in Ruby
Alex Teut
 
Dev Concepts: Functional Programming
Dev Concepts: Functional ProgrammingDev Concepts: Functional Programming
Dev Concepts: Functional Programming
Svetlin Nakov
 
Java 8 Functional Programming - I
Java 8 Functional Programming - IJava 8 Functional Programming - I
Java 8 Functional Programming - I
Ugur Yeter
 
Functional programming
Functional programmingFunctional programming
Functional programming
Kibru Demeke
 
VIT351 Software Development VI Unit1
VIT351 Software Development VI Unit1VIT351 Software Development VI Unit1
VIT351 Software Development VI Unit1
YOGESH SINGH
 
Ruby Functional Programming
Ruby Functional ProgrammingRuby Functional Programming
Ruby Functional Programming
Geison Goes
 
Python functional programming
Python functional programmingPython functional programming
Python functional programming
Geison Goes
 
Introduction to functional programming (In Arabic)
Introduction to functional programming (In Arabic)Introduction to functional programming (In Arabic)
Introduction to functional programming (In Arabic)
Omar Abdelhafith
 

Similar to Aaa ped-2- Python: Basics (20)

pythontraining-201jn026043638.pptx
pythontraining-201jn026043638.pptxpythontraining-201jn026043638.pptx
pythontraining-201jn026043638.pptx
RohitKumar639388
 
Functional programming in Scala
Functional programming in ScalaFunctional programming in Scala
Functional programming in Scala
datamantra
 
Python training
Python trainingPython training
Python training
Kunalchauhan76
 
Python presentation of Government Engineering College Aurangabad, Bihar
Python presentation of Government Engineering College Aurangabad, BiharPython presentation of Government Engineering College Aurangabad, Bihar
Python presentation of Government Engineering College Aurangabad, Bihar
UttamKumar617567
 
Functions-.pdf
Functions-.pdfFunctions-.pdf
Functions-.pdf
arvdexamsection
 
First Steps in Python Programming
First Steps in Python ProgrammingFirst Steps in Python Programming
First Steps in Python Programming
Dozie Agbo
 
Aaa ped-3. Pythond: advanced concepts
Aaa ped-3. Pythond: advanced conceptsAaa ped-3. Pythond: advanced concepts
Aaa ped-3. Pythond: advanced concepts
AminaRepo
 
Functional Programming.pptx
Functional Programming.pptxFunctional Programming.pptx
Functional Programming.pptx
KarthickT28
 
Dive into Python Functions Fundamental Concepts.pdf
Dive into Python Functions Fundamental Concepts.pdfDive into Python Functions Fundamental Concepts.pdf
Dive into Python Functions Fundamental Concepts.pdf
SudhanshiBakre1
 
Blueprints: Introduction to Python programming
Blueprints: Introduction to Python programmingBlueprints: Introduction to Python programming
Blueprints: Introduction to Python programming
Bhalaji Nagarajan
 
Chapter - 4.pptx
Chapter - 4.pptxChapter - 4.pptx
Chapter - 4.pptx
MikialeTesfamariam
 
Python intro
Python introPython intro
Python intro
Piyush rai
 
Mastering Python lesson 4_functions_parameters_arguments
Mastering Python lesson 4_functions_parameters_argumentsMastering Python lesson 4_functions_parameters_arguments
Mastering Python lesson 4_functions_parameters_arguments
Ruth Marvin
 
ProgFund_Lecture_4_Functions_and_Modules-1.pdf
ProgFund_Lecture_4_Functions_and_Modules-1.pdfProgFund_Lecture_4_Functions_and_Modules-1.pdf
ProgFund_Lecture_4_Functions_and_Modules-1.pdf
lailoesakhan
 
Functions
FunctionsFunctions
Functions
Learn By Watch
 
New c sharp4_features_part_i
New c sharp4_features_part_iNew c sharp4_features_part_i
New c sharp4_features_part_i
Nico Ludwig
 
Introduction to Koltin for Android Part I
Introduction to Koltin for Android Part I Introduction to Koltin for Android Part I
Introduction to Koltin for Android Part I
Atif AbbAsi
 
ACM init()- Day 4
ACM init()- Day 4ACM init()- Day 4
ACM init()- Day 4
UCLA Association of Computing Machinery
 
Q-Step_WS_02102019_Practical_introduction_to_Python.pptx
Q-Step_WS_02102019_Practical_introduction_to_Python.pptxQ-Step_WS_02102019_Practical_introduction_to_Python.pptx
Q-Step_WS_02102019_Practical_introduction_to_Python.pptx
nyomans1
 
Q-SPractical_introduction_to_Python.pptx
Q-SPractical_introduction_to_Python.pptxQ-SPractical_introduction_to_Python.pptx
Q-SPractical_introduction_to_Python.pptx
JeromeTacata3
 
pythontraining-201jn026043638.pptx
pythontraining-201jn026043638.pptxpythontraining-201jn026043638.pptx
pythontraining-201jn026043638.pptx
RohitKumar639388
 
Functional programming in Scala
Functional programming in ScalaFunctional programming in Scala
Functional programming in Scala
datamantra
 
Python presentation of Government Engineering College Aurangabad, Bihar
Python presentation of Government Engineering College Aurangabad, BiharPython presentation of Government Engineering College Aurangabad, Bihar
Python presentation of Government Engineering College Aurangabad, Bihar
UttamKumar617567
 
First Steps in Python Programming
First Steps in Python ProgrammingFirst Steps in Python Programming
First Steps in Python Programming
Dozie Agbo
 
Aaa ped-3. Pythond: advanced concepts
Aaa ped-3. Pythond: advanced conceptsAaa ped-3. Pythond: advanced concepts
Aaa ped-3. Pythond: advanced concepts
AminaRepo
 
Functional Programming.pptx
Functional Programming.pptxFunctional Programming.pptx
Functional Programming.pptx
KarthickT28
 
Dive into Python Functions Fundamental Concepts.pdf
Dive into Python Functions Fundamental Concepts.pdfDive into Python Functions Fundamental Concepts.pdf
Dive into Python Functions Fundamental Concepts.pdf
SudhanshiBakre1
 
Blueprints: Introduction to Python programming
Blueprints: Introduction to Python programmingBlueprints: Introduction to Python programming
Blueprints: Introduction to Python programming
Bhalaji Nagarajan
 
Mastering Python lesson 4_functions_parameters_arguments
Mastering Python lesson 4_functions_parameters_argumentsMastering Python lesson 4_functions_parameters_arguments
Mastering Python lesson 4_functions_parameters_arguments
Ruth Marvin
 
ProgFund_Lecture_4_Functions_and_Modules-1.pdf
ProgFund_Lecture_4_Functions_and_Modules-1.pdfProgFund_Lecture_4_Functions_and_Modules-1.pdf
ProgFund_Lecture_4_Functions_and_Modules-1.pdf
lailoesakhan
 
New c sharp4_features_part_i
New c sharp4_features_part_iNew c sharp4_features_part_i
New c sharp4_features_part_i
Nico Ludwig
 
Introduction to Koltin for Android Part I
Introduction to Koltin for Android Part I Introduction to Koltin for Android Part I
Introduction to Koltin for Android Part I
Atif AbbAsi
 
Q-Step_WS_02102019_Practical_introduction_to_Python.pptx
Q-Step_WS_02102019_Practical_introduction_to_Python.pptxQ-Step_WS_02102019_Practical_introduction_to_Python.pptx
Q-Step_WS_02102019_Practical_introduction_to_Python.pptx
nyomans1
 
Q-SPractical_introduction_to_Python.pptx
Q-SPractical_introduction_to_Python.pptxQ-SPractical_introduction_to_Python.pptx
Q-SPractical_introduction_to_Python.pptx
JeromeTacata3
 

More from AminaRepo (20)

Aaa ped-23-Artificial Neural Network: Keras and Tensorfow
Aaa ped-23-Artificial Neural Network: Keras and TensorfowAaa ped-23-Artificial Neural Network: Keras and Tensorfow
Aaa ped-23-Artificial Neural Network: Keras and Tensorfow
AminaRepo
 
Aaa ped-22-Artificial Neural Network: Introduction to ANN
Aaa ped-22-Artificial Neural Network: Introduction to ANNAaa ped-22-Artificial Neural Network: Introduction to ANN
Aaa ped-22-Artificial Neural Network: Introduction to ANN
AminaRepo
 
Aaa ped-21-Recommender Systems: Content-based Filtering
Aaa ped-21-Recommender Systems: Content-based FilteringAaa ped-21-Recommender Systems: Content-based Filtering
Aaa ped-21-Recommender Systems: Content-based Filtering
AminaRepo
 
Aaa ped-20-Recommender Systems: Model-based collaborative filtering
Aaa ped-20-Recommender Systems: Model-based collaborative filteringAaa ped-20-Recommender Systems: Model-based collaborative filtering
Aaa ped-20-Recommender Systems: Model-based collaborative filtering
AminaRepo
 
Aaa ped-19-Recommender Systems: Neighborhood-based Filtering
Aaa ped-19-Recommender Systems: Neighborhood-based FilteringAaa ped-19-Recommender Systems: Neighborhood-based Filtering
Aaa ped-19-Recommender Systems: Neighborhood-based Filtering
AminaRepo
 
Aaa ped-18-Unsupervised Learning: Association Rule Learning
Aaa ped-18-Unsupervised Learning: Association Rule LearningAaa ped-18-Unsupervised Learning: Association Rule Learning
Aaa ped-18-Unsupervised Learning: Association Rule Learning
AminaRepo
 
Aaa ped-17-Unsupervised Learning: Dimensionality reduction
Aaa ped-17-Unsupervised Learning: Dimensionality reductionAaa ped-17-Unsupervised Learning: Dimensionality reduction
Aaa ped-17-Unsupervised Learning: Dimensionality reduction
AminaRepo
 
Aaa ped-16-Unsupervised Learning: clustering
Aaa ped-16-Unsupervised Learning: clusteringAaa ped-16-Unsupervised Learning: clustering
Aaa ped-16-Unsupervised Learning: clustering
AminaRepo
 
Aaa ped-15-Ensemble Learning: Random Forests
Aaa ped-15-Ensemble Learning: Random ForestsAaa ped-15-Ensemble Learning: Random Forests
Aaa ped-15-Ensemble Learning: Random Forests
AminaRepo
 
Aaa ped-14-Ensemble Learning: About Ensemble Learning
Aaa ped-14-Ensemble Learning: About Ensemble LearningAaa ped-14-Ensemble Learning: About Ensemble Learning
Aaa ped-14-Ensemble Learning: About Ensemble Learning
AminaRepo
 
Aaa ped-12-Supervised Learning: Support Vector Machines & Naive Bayes Classifer
Aaa ped-12-Supervised Learning: Support Vector Machines & Naive Bayes ClassiferAaa ped-12-Supervised Learning: Support Vector Machines & Naive Bayes Classifer
Aaa ped-12-Supervised Learning: Support Vector Machines & Naive Bayes Classifer
AminaRepo
 
Aaa ped-11-Supervised Learning: Multivariable Regressor & Classifers
Aaa ped-11-Supervised Learning: Multivariable Regressor & ClassifersAaa ped-11-Supervised Learning: Multivariable Regressor & Classifers
Aaa ped-11-Supervised Learning: Multivariable Regressor & Classifers
AminaRepo
 
Aaa ped-10-Supervised Learning: Introduction to Supervised Learning
Aaa ped-10-Supervised Learning: Introduction to Supervised LearningAaa ped-10-Supervised Learning: Introduction to Supervised Learning
Aaa ped-10-Supervised Learning: Introduction to Supervised Learning
AminaRepo
 
Aaa ped-9-Data manipulation: Time Series & Geographical visualization
Aaa ped-9-Data manipulation: Time Series & Geographical visualizationAaa ped-9-Data manipulation: Time Series & Geographical visualization
Aaa ped-9-Data manipulation: Time Series & Geographical visualization
AminaRepo
 
Aaa ped-Data-8- manipulation: Plotting and Visualization
Aaa ped-Data-8- manipulation: Plotting and VisualizationAaa ped-Data-8- manipulation: Plotting and Visualization
Aaa ped-Data-8- manipulation: Plotting and Visualization
AminaRepo
 
Aaa ped-8- Data manipulation: Data wrangling, aggregation, and group operations
Aaa ped-8- Data manipulation: Data wrangling, aggregation, and group operationsAaa ped-8- Data manipulation: Data wrangling, aggregation, and group operations
Aaa ped-8- Data manipulation: Data wrangling, aggregation, and group operations
AminaRepo
 
Aaa ped-6-Data manipulation: Data Files, and Data Cleaning & Preparation
Aaa ped-6-Data manipulation:  Data Files, and Data Cleaning & PreparationAaa ped-6-Data manipulation:  Data Files, and Data Cleaning & Preparation
Aaa ped-6-Data manipulation: Data Files, and Data Cleaning & Preparation
AminaRepo
 
Aaa ped-5-Data manipulation: Pandas
Aaa ped-5-Data manipulation: Pandas Aaa ped-5-Data manipulation: Pandas
Aaa ped-5-Data manipulation: Pandas
AminaRepo
 
Aaa ped-4- Data manipulation: Numpy
Aaa ped-4- Data manipulation: Numpy Aaa ped-4- Data manipulation: Numpy
Aaa ped-4- Data manipulation: Numpy
AminaRepo
 
Aaa ped-1- Python: Introduction to AI, Python and Colab
Aaa ped-1- Python: Introduction to AI, Python and ColabAaa ped-1- Python: Introduction to AI, Python and Colab
Aaa ped-1- Python: Introduction to AI, Python and Colab
AminaRepo
 
Aaa ped-23-Artificial Neural Network: Keras and Tensorfow
Aaa ped-23-Artificial Neural Network: Keras and TensorfowAaa ped-23-Artificial Neural Network: Keras and Tensorfow
Aaa ped-23-Artificial Neural Network: Keras and Tensorfow
AminaRepo
 
Aaa ped-22-Artificial Neural Network: Introduction to ANN
Aaa ped-22-Artificial Neural Network: Introduction to ANNAaa ped-22-Artificial Neural Network: Introduction to ANN
Aaa ped-22-Artificial Neural Network: Introduction to ANN
AminaRepo
 
Aaa ped-21-Recommender Systems: Content-based Filtering
Aaa ped-21-Recommender Systems: Content-based FilteringAaa ped-21-Recommender Systems: Content-based Filtering
Aaa ped-21-Recommender Systems: Content-based Filtering
AminaRepo
 
Aaa ped-20-Recommender Systems: Model-based collaborative filtering
Aaa ped-20-Recommender Systems: Model-based collaborative filteringAaa ped-20-Recommender Systems: Model-based collaborative filtering
Aaa ped-20-Recommender Systems: Model-based collaborative filtering
AminaRepo
 
Aaa ped-19-Recommender Systems: Neighborhood-based Filtering
Aaa ped-19-Recommender Systems: Neighborhood-based FilteringAaa ped-19-Recommender Systems: Neighborhood-based Filtering
Aaa ped-19-Recommender Systems: Neighborhood-based Filtering
AminaRepo
 
Aaa ped-18-Unsupervised Learning: Association Rule Learning
Aaa ped-18-Unsupervised Learning: Association Rule LearningAaa ped-18-Unsupervised Learning: Association Rule Learning
Aaa ped-18-Unsupervised Learning: Association Rule Learning
AminaRepo
 
Aaa ped-17-Unsupervised Learning: Dimensionality reduction
Aaa ped-17-Unsupervised Learning: Dimensionality reductionAaa ped-17-Unsupervised Learning: Dimensionality reduction
Aaa ped-17-Unsupervised Learning: Dimensionality reduction
AminaRepo
 
Aaa ped-16-Unsupervised Learning: clustering
Aaa ped-16-Unsupervised Learning: clusteringAaa ped-16-Unsupervised Learning: clustering
Aaa ped-16-Unsupervised Learning: clustering
AminaRepo
 
Aaa ped-15-Ensemble Learning: Random Forests
Aaa ped-15-Ensemble Learning: Random ForestsAaa ped-15-Ensemble Learning: Random Forests
Aaa ped-15-Ensemble Learning: Random Forests
AminaRepo
 
Aaa ped-14-Ensemble Learning: About Ensemble Learning
Aaa ped-14-Ensemble Learning: About Ensemble LearningAaa ped-14-Ensemble Learning: About Ensemble Learning
Aaa ped-14-Ensemble Learning: About Ensemble Learning
AminaRepo
 
Aaa ped-12-Supervised Learning: Support Vector Machines & Naive Bayes Classifer
Aaa ped-12-Supervised Learning: Support Vector Machines & Naive Bayes ClassiferAaa ped-12-Supervised Learning: Support Vector Machines & Naive Bayes Classifer
Aaa ped-12-Supervised Learning: Support Vector Machines & Naive Bayes Classifer
AminaRepo
 
Aaa ped-11-Supervised Learning: Multivariable Regressor & Classifers
Aaa ped-11-Supervised Learning: Multivariable Regressor & ClassifersAaa ped-11-Supervised Learning: Multivariable Regressor & Classifers
Aaa ped-11-Supervised Learning: Multivariable Regressor & Classifers
AminaRepo
 
Aaa ped-10-Supervised Learning: Introduction to Supervised Learning
Aaa ped-10-Supervised Learning: Introduction to Supervised LearningAaa ped-10-Supervised Learning: Introduction to Supervised Learning
Aaa ped-10-Supervised Learning: Introduction to Supervised Learning
AminaRepo
 
Aaa ped-9-Data manipulation: Time Series & Geographical visualization
Aaa ped-9-Data manipulation: Time Series & Geographical visualizationAaa ped-9-Data manipulation: Time Series & Geographical visualization
Aaa ped-9-Data manipulation: Time Series & Geographical visualization
AminaRepo
 
Aaa ped-Data-8- manipulation: Plotting and Visualization
Aaa ped-Data-8- manipulation: Plotting and VisualizationAaa ped-Data-8- manipulation: Plotting and Visualization
Aaa ped-Data-8- manipulation: Plotting and Visualization
AminaRepo
 
Aaa ped-8- Data manipulation: Data wrangling, aggregation, and group operations
Aaa ped-8- Data manipulation: Data wrangling, aggregation, and group operationsAaa ped-8- Data manipulation: Data wrangling, aggregation, and group operations
Aaa ped-8- Data manipulation: Data wrangling, aggregation, and group operations
AminaRepo
 
Aaa ped-6-Data manipulation: Data Files, and Data Cleaning & Preparation
Aaa ped-6-Data manipulation:  Data Files, and Data Cleaning & PreparationAaa ped-6-Data manipulation:  Data Files, and Data Cleaning & Preparation
Aaa ped-6-Data manipulation: Data Files, and Data Cleaning & Preparation
AminaRepo
 
Aaa ped-5-Data manipulation: Pandas
Aaa ped-5-Data manipulation: Pandas Aaa ped-5-Data manipulation: Pandas
Aaa ped-5-Data manipulation: Pandas
AminaRepo
 
Aaa ped-4- Data manipulation: Numpy
Aaa ped-4- Data manipulation: Numpy Aaa ped-4- Data manipulation: Numpy
Aaa ped-4- Data manipulation: Numpy
AminaRepo
 
Aaa ped-1- Python: Introduction to AI, Python and Colab
Aaa ped-1- Python: Introduction to AI, Python and ColabAaa ped-1- Python: Introduction to AI, Python and Colab
Aaa ped-1- Python: Introduction to AI, Python and Colab
AminaRepo
 

Recently uploaded (20)

Skin_Glands_Structure_Secretion _Control
Skin_Glands_Structure_Secretion _ControlSkin_Glands_Structure_Secretion _Control
Skin_Glands_Structure_Secretion _Control
muralinath2
 
Concise Notes on tree and graph data structure
Concise Notes on tree and graph data structureConcise Notes on tree and graph data structure
Concise Notes on tree and graph data structure
YekoyeTigabu2
 
Infrastructure for Tracking Information Flow from Social Media to U.S. TV New...
Infrastructure for Tracking Information Flow from Social Media to U.S. TV New...Infrastructure for Tracking Information Flow from Social Media to U.S. TV New...
Infrastructure for Tracking Information Flow from Social Media to U.S. TV New...
Himarsha Jayanetti
 
Hardy_Weinbergs_law_and[1]. A simple Explanation
Hardy_Weinbergs_law_and[1]. A simple ExplanationHardy_Weinbergs_law_and[1]. A simple Explanation
Hardy_Weinbergs_law_and[1]. A simple Explanation
Dr Showkat Ahmad Wani
 
Class-11-notes- Inorganic Chemistry Hydrogen, Oxygen,Ozone,Carbon,Phosphoros
Class-11-notes- Inorganic Chemistry Hydrogen, Oxygen,Ozone,Carbon,PhosphorosClass-11-notes- Inorganic Chemistry Hydrogen, Oxygen,Ozone,Carbon,Phosphoros
Class-11-notes- Inorganic Chemistry Hydrogen, Oxygen,Ozone,Carbon,Phosphoros
govindapathak8
 
2025 Insilicogen Company Korean Brochure
2025 Insilicogen Company Korean Brochure2025 Insilicogen Company Korean Brochure
2025 Insilicogen Company Korean Brochure
Insilico Gen
 
APES 6.5 Presentation Fossil Fuels .pdf
APES 6.5 Presentation Fossil Fuels   .pdfAPES 6.5 Presentation Fossil Fuels   .pdf
APES 6.5 Presentation Fossil Fuels .pdf
patelereftu
 
Metallurgical process class 11_Govinda Pathak
Metallurgical process class 11_Govinda PathakMetallurgical process class 11_Govinda Pathak
Metallurgical process class 11_Govinda Pathak
GovindaPathak6
 
Gender Bias and Empathy in Robots: Insights into Robotic Service Failures
Gender Bias and Empathy in Robots:  Insights into Robotic Service FailuresGender Bias and Empathy in Robots:  Insights into Robotic Service Failures
Gender Bias and Empathy in Robots: Insights into Robotic Service Failures
Selcen Ozturkcan
 
2025 Insilicogen Company English Brochure
2025 Insilicogen Company English Brochure2025 Insilicogen Company English Brochure
2025 Insilicogen Company English Brochure
Insilico Gen
 
Introduction to Mobile Forensics Part 1.pptx
Introduction to Mobile Forensics Part 1.pptxIntroduction to Mobile Forensics Part 1.pptx
Introduction to Mobile Forensics Part 1.pptx
Nivya George
 
Vital Vitamins: A Clinical Nutrition Approach to Functions, Deficiency & Sources
Vital Vitamins: A Clinical Nutrition Approach to Functions, Deficiency & SourcesVital Vitamins: A Clinical Nutrition Approach to Functions, Deficiency & Sources
Vital Vitamins: A Clinical Nutrition Approach to Functions, Deficiency & Sources
Sarumathi Murugesan
 
Turkey Diseases and Disorders Volume 2 Infectious and Nutritional Diseases, D...
Turkey Diseases and Disorders Volume 2 Infectious and Nutritional Diseases, D...Turkey Diseases and Disorders Volume 2 Infectious and Nutritional Diseases, D...
Turkey Diseases and Disorders Volume 2 Infectious and Nutritional Diseases, D...
Ali Raei
 
UNIT chromatography instrumental6 .pptx
UNIT chromatography  instrumental6 .pptxUNIT chromatography  instrumental6 .pptx
UNIT chromatography instrumental6 .pptx
myselfit143
 
Physics of heat and radiation by the book
Physics of heat and radiation by the bookPhysics of heat and radiation by the book
Physics of heat and radiation by the book
Mominaakram4
 
Skin function_protective_absorptive_Presentatation.pptx
Skin function_protective_absorptive_Presentatation.pptxSkin function_protective_absorptive_Presentatation.pptx
Skin function_protective_absorptive_Presentatation.pptx
muralinath2
 
Water analysis practical for ph, tds, hardness, acidity, conductivity, and ba...
Water analysis practical for ph, tds, hardness, acidity, conductivity, and ba...Water analysis practical for ph, tds, hardness, acidity, conductivity, and ba...
Water analysis practical for ph, tds, hardness, acidity, conductivity, and ba...
ss0077014
 
A tale of two Lucies: talk at the maths dept, Free University of Amsterdam
A tale of two Lucies: talk at the maths dept, Free University of AmsterdamA tale of two Lucies: talk at the maths dept, Free University of Amsterdam
A tale of two Lucies: talk at the maths dept, Free University of Amsterdam
Richard Gill
 
amino compounds.pptx class 12_Govinda Pathak
amino compounds.pptx class 12_Govinda Pathakamino compounds.pptx class 12_Govinda Pathak
amino compounds.pptx class 12_Govinda Pathak
GovindaPathak6
 
RAPID DIAGNOSTIC TEST (RDT) overviewppt.pptx
RAPID DIAGNOSTIC TEST (RDT)  overviewppt.pptxRAPID DIAGNOSTIC TEST (RDT)  overviewppt.pptx
RAPID DIAGNOSTIC TEST (RDT) overviewppt.pptx
nietakam
 
Skin_Glands_Structure_Secretion _Control
Skin_Glands_Structure_Secretion _ControlSkin_Glands_Structure_Secretion _Control
Skin_Glands_Structure_Secretion _Control
muralinath2
 
Concise Notes on tree and graph data structure
Concise Notes on tree and graph data structureConcise Notes on tree and graph data structure
Concise Notes on tree and graph data structure
YekoyeTigabu2
 
Infrastructure for Tracking Information Flow from Social Media to U.S. TV New...
Infrastructure for Tracking Information Flow from Social Media to U.S. TV New...Infrastructure for Tracking Information Flow from Social Media to U.S. TV New...
Infrastructure for Tracking Information Flow from Social Media to U.S. TV New...
Himarsha Jayanetti
 
Hardy_Weinbergs_law_and[1]. A simple Explanation
Hardy_Weinbergs_law_and[1]. A simple ExplanationHardy_Weinbergs_law_and[1]. A simple Explanation
Hardy_Weinbergs_law_and[1]. A simple Explanation
Dr Showkat Ahmad Wani
 
Class-11-notes- Inorganic Chemistry Hydrogen, Oxygen,Ozone,Carbon,Phosphoros
Class-11-notes- Inorganic Chemistry Hydrogen, Oxygen,Ozone,Carbon,PhosphorosClass-11-notes- Inorganic Chemistry Hydrogen, Oxygen,Ozone,Carbon,Phosphoros
Class-11-notes- Inorganic Chemistry Hydrogen, Oxygen,Ozone,Carbon,Phosphoros
govindapathak8
 
2025 Insilicogen Company Korean Brochure
2025 Insilicogen Company Korean Brochure2025 Insilicogen Company Korean Brochure
2025 Insilicogen Company Korean Brochure
Insilico Gen
 
APES 6.5 Presentation Fossil Fuels .pdf
APES 6.5 Presentation Fossil Fuels   .pdfAPES 6.5 Presentation Fossil Fuels   .pdf
APES 6.5 Presentation Fossil Fuels .pdf
patelereftu
 
Metallurgical process class 11_Govinda Pathak
Metallurgical process class 11_Govinda PathakMetallurgical process class 11_Govinda Pathak
Metallurgical process class 11_Govinda Pathak
GovindaPathak6
 
Gender Bias and Empathy in Robots: Insights into Robotic Service Failures
Gender Bias and Empathy in Robots:  Insights into Robotic Service FailuresGender Bias and Empathy in Robots:  Insights into Robotic Service Failures
Gender Bias and Empathy in Robots: Insights into Robotic Service Failures
Selcen Ozturkcan
 
2025 Insilicogen Company English Brochure
2025 Insilicogen Company English Brochure2025 Insilicogen Company English Brochure
2025 Insilicogen Company English Brochure
Insilico Gen
 
Introduction to Mobile Forensics Part 1.pptx
Introduction to Mobile Forensics Part 1.pptxIntroduction to Mobile Forensics Part 1.pptx
Introduction to Mobile Forensics Part 1.pptx
Nivya George
 
Vital Vitamins: A Clinical Nutrition Approach to Functions, Deficiency & Sources
Vital Vitamins: A Clinical Nutrition Approach to Functions, Deficiency & SourcesVital Vitamins: A Clinical Nutrition Approach to Functions, Deficiency & Sources
Vital Vitamins: A Clinical Nutrition Approach to Functions, Deficiency & Sources
Sarumathi Murugesan
 
Turkey Diseases and Disorders Volume 2 Infectious and Nutritional Diseases, D...
Turkey Diseases and Disorders Volume 2 Infectious and Nutritional Diseases, D...Turkey Diseases and Disorders Volume 2 Infectious and Nutritional Diseases, D...
Turkey Diseases and Disorders Volume 2 Infectious and Nutritional Diseases, D...
Ali Raei
 
UNIT chromatography instrumental6 .pptx
UNIT chromatography  instrumental6 .pptxUNIT chromatography  instrumental6 .pptx
UNIT chromatography instrumental6 .pptx
myselfit143
 
Physics of heat and radiation by the book
Physics of heat and radiation by the bookPhysics of heat and radiation by the book
Physics of heat and radiation by the book
Mominaakram4
 
Skin function_protective_absorptive_Presentatation.pptx
Skin function_protective_absorptive_Presentatation.pptxSkin function_protective_absorptive_Presentatation.pptx
Skin function_protective_absorptive_Presentatation.pptx
muralinath2
 
Water analysis practical for ph, tds, hardness, acidity, conductivity, and ba...
Water analysis practical for ph, tds, hardness, acidity, conductivity, and ba...Water analysis practical for ph, tds, hardness, acidity, conductivity, and ba...
Water analysis practical for ph, tds, hardness, acidity, conductivity, and ba...
ss0077014
 
A tale of two Lucies: talk at the maths dept, Free University of Amsterdam
A tale of two Lucies: talk at the maths dept, Free University of AmsterdamA tale of two Lucies: talk at the maths dept, Free University of Amsterdam
A tale of two Lucies: talk at the maths dept, Free University of Amsterdam
Richard Gill
 
amino compounds.pptx class 12_Govinda Pathak
amino compounds.pptx class 12_Govinda Pathakamino compounds.pptx class 12_Govinda Pathak
amino compounds.pptx class 12_Govinda Pathak
GovindaPathak6
 
RAPID DIAGNOSTIC TEST (RDT) overviewppt.pptx
RAPID DIAGNOSTIC TEST (RDT)  overviewppt.pptxRAPID DIAGNOSTIC TEST (RDT)  overviewppt.pptx
RAPID DIAGNOSTIC TEST (RDT) overviewppt.pptx
nietakam
 

Aaa ped-2- Python: Basics

  • 2. Plan ● 1- Basic Operations and variables ● 2- Basic Types ● 3- Functions and white space formatting ● 4- Modules and Libraries ● 5- Examples of some Libraries ● 6- Installing Libraries in Google Colab
  • 3. 3 1-BasicOperations Andvariables [By Amina Delali] ● To perform simple operations, you just have to type them: Integer division/floored quotient Modulus (remainder) Exponent
  • 4. 4 1-BasicOperations Andvariables [By Amina Delali] ● Other type of operations: If 5 wasn’t greater than 3, it would returned False Is 5 different from 3 Is 5 equal to 3 The only case this expression is evaluated to False, it’s when the two operands are evaluated to False The only case this expression is evaluated to True, it’s when the two operands are evaluated to True
  • 5. 5 1-BasicOperations Andvariables [By Amina Delali] ● Table of precedence of some operators (increasing order) To evaluate an expression with multiple operators,the “precedence” rule apply Expression between parentheses is evaluated first:(-1+1)=0 Then the exponentiation is evaluated: 6**0=1 Then the multiplication is evaluated: 3*1=3 Then the addition is evaluated: 5+3=8 The full table can be seen at: https://docs.python.org/3.6/reference/expressions.html#operator-precedence or and not < , <= , > , >= , != , == +, - * , / , // , % ** ( ) Highest precedence Operators in the same box have same precedence Operators in the same box group from left to right (except for exponentiation **).For example, to evaluate 5 / 4 * 2 : We start by: 5 / 4 = 1.25 (the most left operator) Then: 1.25 * 2 = 2.5 (we continue with the following one)
  • 6. 6 1-BasicOperations Andvariables [By Amina Delali] ● We can store values of expressions in “variables” with the “assignment” statement: Assignment statement Variable name ● Variable names have some mandatory characteristics ● Composed of 1 word ● Composed only by: letters, number or the underscore character (_) ● Can not start with a number The value of “a” is 3, and the value of “b” is 5
  • 7. 7 1-BasicOperations Andvariables [By Amina Delali] ● We can assign one value to multiple variables ● We can assign multiple values to multiples variables:
  • 8. 8 2-BasicTypes [By Amina Delali] ● Numbers ● Integer 5 -3 0 1000 ● Float 7.8 -3.156 0.0 ● Complex 5.3+2j 10+1J ● A number can be: Real part Imaginary part
  • 9. 9 2-BasicTypes [By Amina Delali] Strings ● String are text values written between quotes:
  • 10. 10 2-BasicTypes [By Amina Delali] Strings ● With Strings, we can perform Concatenation and Replication operations:
  • 11. 11 2-BasicTypes [By Amina Delali] ● Boolean ● They have only two values: True and False ● In a numeric context: True behaves like 1 and False like 0 ● The Boolean operators are : and, or, not
  • 12. 12 3-Functionsand whitespace formatting [By Amina Delali] ● Functions are a “reusable” block of code. ● They can be “built-in” functions: already defned ● They can be also “user-defned”: you can defne your own functions. ● Example of built-in functions: Functions Number of character of string S1
  • 14. 14 3-Functionsand whitespace formatting [By Amina Delali] User defined functions White space formatting ● Python uses indentation to define blocks of code ● Blocks begin when the indentation increases ● Blocks end when the indentation decreases ● Whitespace is ignored inside parentheses and brackets The block of code is marked by a colon(:) and its indentation (the space before print) Calling the function (decreasing the indentation to terminate The function definition block)
  • 15. 15 3-Functionsand whitespace formatting [By Amina Delali] ● Return statement The function arguments Keyword and default arguments ● A function can return a value using the keyword “return” The function returns the value of a+b ● In a function call, we can identify the arguments by their name. ● In a function definition, the arguments can have a default value they will be optional
  • 16. 16 3-Functionsand whitespace formatting [By Amina Delali] ● The default value of a third argument So the argument is optional The order of the arguments a and b doesn’t matter, since they are identified by their names
  • 17. 17 4-ModulesandLibraries [By Amina Delali] ● A module is a program that contains a related group of functions that can be embedded in your programs Module and Library ● To use the functions module you have to use the “import” statement. ● Other statement with import like “from” and “as” can be used ● A set of modules define a Library ● Python comes with a library called the standard library ● To use an other library modules, you have to install the corresponding library : a third-party library
  • 18. 18 4-ModulesandLibraries [By Amina Delali] Function “randint “from module random Only “randint” was imported The name of “randint” was replaced by “ri”
  • 19. 19 5-Examplesofsome Libraries [By Amina Delali] ● Third-party libraries ● Numpy: is the fundamental package for scientific computing with Python ● Pandas: is an open source, BSD-licensed library providing high- performance, easy-to-use data structures and data analysis tools for the Python programming language. ● Matpolotlib: is a Python 2D plotting library ● Tensorflow: An open source machine learning framework for everyone. It is a software library for high performance numerical computation.
  • 22. 22 6-InstallingLibraries inGoogleColab [By Amina Delali] ! pip install apt-get After !apt-get update From:( https://colab.research.google.com/notebooks/snippets/importing_libraries.ipynb)
  • 23. References ● Duchesnay Edouard and Löfstedt Tommy.Statistics and machine learning in python release 0.2. On-line at ftp: //ftp.cea.fr/pub/unati/people/educhesnay/pystatml/M1_IMSV/ StatisticsMachineLearningPythonDraft.pdf. Accessed on 23-09-2018. ● Python Software Foundation. The python language reference. On-line at https://docs.python.org/3.6/reference/index.html. Accessed on 23-09-2018. ● Python Software Foundation. The python standard library. On-line at ● https://docs.python.org/3.6/library/index.html. Accessed on 23-09-2018. ● Joel Grus. Data science from scratch: frst principles with python. O’Reilly Media, Inc, 2015. ● J. D. Hunter. Matplotlib: A 2d graphics environment. Computing In Science & Engineering, 9(3):90–95, 2007. ● NumPy. Numpy. On-line at http://www.numpy.org/. Accessed on 23-09-2018.
  • 24. References ● pandas. pandas. On-line at https://pandas.pydata.org/. Accessed on 23-09-2018. ● Chandat Sunny. Learn Python in 24 Hours. CreateSpace Independent Publishing Platform, 2016. ● Al Sweigart. Automate the boring stuf with Python: practical programming for total beginners. No Starch Press, 2015. ● TensorFlow. About tensorfow. On-line at https://www.tensorfow. org/. Accessed on 23-09-2018.