SlideShare a Scribd company logo
1 of 25
Download to read offline
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

Function in C Programming
Function in C ProgrammingFunction in C Programming
Function in C ProgrammingAnil Pokhrel
 
Java 8 Lambda Expressions & Streams
Java 8 Lambda Expressions & StreamsJava 8 Lambda Expressions & Streams
Java 8 Lambda Expressions & StreamsNewCircle Training
 
Functional programming in scala
Functional programming in scalaFunctional programming in scala
Functional programming in scalaStratio
 
Intro to JavaScript - Week 2: Function
Intro to JavaScript - Week 2: FunctionIntro to JavaScript - Week 2: Function
Intro to JavaScript - Week 2: FunctionJeongbae Oh
 
Functional Programming in Ruby
Functional Programming in RubyFunctional Programming in Ruby
Functional Programming in RubyAlex Teut
 
Dev Concepts: Functional Programming
Dev Concepts: Functional ProgrammingDev Concepts: Functional Programming
Dev Concepts: Functional ProgrammingSvetlin Nakov
 
Java 8 Functional Programming - I
Java 8 Functional Programming - IJava 8 Functional Programming - I
Java 8 Functional Programming - IUgur Yeter
 
Functional programming
Functional programmingFunctional programming
Functional programmingKibru Demeke
 
VIT351 Software Development VI Unit1
VIT351 Software Development VI Unit1VIT351 Software Development VI Unit1
VIT351 Software Development VI Unit1YOGESH SINGH
 
Ruby Functional Programming
Ruby Functional ProgrammingRuby Functional Programming
Ruby Functional ProgrammingGeison Goes
 
Python functional programming
Python functional programmingPython functional programming
Python functional programmingGeison 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
 

What's hot (20)

Function in C Programming
Function in C ProgrammingFunction in C Programming
Function in C Programming
 
Java 8 Lambda Expressions & Streams
Java 8 Lambda Expressions & StreamsJava 8 Lambda Expressions & Streams
Java 8 Lambda Expressions & Streams
 
Functional programming in scala
Functional programming in scalaFunctional programming in scala
Functional programming in scala
 
Intro to JavaScript - Week 2: Function
Intro to JavaScript - Week 2: FunctionIntro to JavaScript - Week 2: Function
Intro to JavaScript - Week 2: Function
 
Python recursion
Python recursionPython recursion
Python recursion
 
Functional Programming in Ruby
Functional Programming in RubyFunctional Programming in Ruby
Functional Programming in Ruby
 
Dev Concepts: Functional Programming
Dev Concepts: Functional ProgrammingDev Concepts: Functional Programming
Dev Concepts: Functional Programming
 
Function & Recursion
Function & RecursionFunction & Recursion
Function & Recursion
 
Java 8 Functional Programming - I
Java 8 Functional Programming - IJava 8 Functional Programming - I
Java 8 Functional Programming - I
 
Function
FunctionFunction
Function
 
Python algorithm
Python algorithmPython algorithm
Python algorithm
 
Functional go
Functional goFunctional go
Functional go
 
Functions in C
Functions in CFunctions in C
Functions in C
 
Functional programming
Functional programmingFunctional programming
Functional programming
 
VIT351 Software Development VI Unit1
VIT351 Software Development VI Unit1VIT351 Software Development VI Unit1
VIT351 Software Development VI Unit1
 
Ruby Functional Programming
Ruby Functional ProgrammingRuby Functional Programming
Ruby Functional Programming
 
user defined function
user defined functionuser defined function
user defined function
 
Python functional programming
Python functional programmingPython functional programming
Python functional programming
 
Think in linq
Think in linqThink in linq
Think in linq
 
Introduction to functional programming (In Arabic)
Introduction to functional programming (In Arabic)Introduction to functional programming (In Arabic)
Introduction to functional programming (In Arabic)
 

Similar to Aaa ped-2- Python: Basics

pythontraining-201jn026043638.pptx
pythontraining-201jn026043638.pptxpythontraining-201jn026043638.pptx
pythontraining-201jn026043638.pptxRohitKumar639388
 
Functional programming in Scala
Functional programming in ScalaFunctional programming in Scala
Functional programming in Scaladatamantra
 
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, BiharUttamKumar617567
 
First Steps in Python Programming
First Steps in Python ProgrammingFirst Steps in Python Programming
First Steps in Python ProgrammingDozie Agbo
 
Aaa ped-3. Pythond: advanced concepts
Aaa ped-3. Pythond: advanced conceptsAaa ped-3. Pythond: advanced concepts
Aaa ped-3. Pythond: advanced conceptsAminaRepo
 
Functional Programming.pptx
Functional Programming.pptxFunctional Programming.pptx
Functional Programming.pptxKarthickT28
 
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.pdfSudhanshiBakre1
 
Blueprints: Introduction to Python programming
Blueprints: Introduction to Python programmingBlueprints: Introduction to Python programming
Blueprints: Introduction to Python programmingBhalaji 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_argumentsRuth 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.pdflailoesakhan
 
New c sharp4_features_part_i
New c sharp4_features_part_iNew c sharp4_features_part_i
New c sharp4_features_part_iNico 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.pptxnyomans1
 
Q-SPractical_introduction_to_Python.pptx
Q-SPractical_introduction_to_Python.pptxQ-SPractical_introduction_to_Python.pptx
Q-SPractical_introduction_to_Python.pptxJeromeTacata3
 

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

pythontraining-201jn026043638.pptx
pythontraining-201jn026043638.pptxpythontraining-201jn026043638.pptx
pythontraining-201jn026043638.pptx
 
Functional programming in Scala
Functional programming in ScalaFunctional programming in Scala
Functional programming in Scala
 
Python training
Python trainingPython training
Python training
 
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
 
Functions-.pdf
Functions-.pdfFunctions-.pdf
Functions-.pdf
 
First Steps in Python Programming
First Steps in Python ProgrammingFirst Steps in Python Programming
First Steps in Python Programming
 
Aaa ped-3. Pythond: advanced concepts
Aaa ped-3. Pythond: advanced conceptsAaa ped-3. Pythond: advanced concepts
Aaa ped-3. Pythond: advanced concepts
 
Functional Programming.pptx
Functional Programming.pptxFunctional Programming.pptx
Functional Programming.pptx
 
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
 
Blueprints: Introduction to Python programming
Blueprints: Introduction to Python programmingBlueprints: Introduction to Python programming
Blueprints: Introduction to Python programming
 
Chapter - 4.pptx
Chapter - 4.pptxChapter - 4.pptx
Chapter - 4.pptx
 
Python intro
Python introPython intro
Python intro
 
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
 
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
 
Functions
FunctionsFunctions
Functions
 
New c sharp4_features_part_i
New c sharp4_features_part_iNew c sharp4_features_part_i
New c sharp4_features_part_i
 
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
 
ACM init()- Day 4
ACM init()- Day 4ACM init()- Day 4
ACM init()- Day 4
 
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
 
Q-SPractical_introduction_to_Python.pptx
Q-SPractical_introduction_to_Python.pptxQ-SPractical_introduction_to_Python.pptx
Q-SPractical_introduction_to_Python.pptx
 

More from 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 TensorfowAminaRepo
 
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 ANNAminaRepo
 
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 FilteringAminaRepo
 
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 filteringAminaRepo
 
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 FilteringAminaRepo
 
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 LearningAminaRepo
 
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 reductionAminaRepo
 
Aaa ped-16-Unsupervised Learning: clustering
Aaa ped-16-Unsupervised Learning: clusteringAaa ped-16-Unsupervised Learning: clustering
Aaa ped-16-Unsupervised Learning: clusteringAminaRepo
 
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 ForestsAminaRepo
 
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 LearningAminaRepo
 
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 ClassiferAminaRepo
 
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 & ClassifersAminaRepo
 
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 LearningAminaRepo
 
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 visualizationAminaRepo
 
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 VisualizationAminaRepo
 
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 operationsAminaRepo
 
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 & PreparationAminaRepo
 
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 ColabAminaRepo
 

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
 
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
 
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
 
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
 
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
 
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
 
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
 
Aaa ped-16-Unsupervised Learning: clustering
Aaa ped-16-Unsupervised Learning: clusteringAaa ped-16-Unsupervised Learning: clustering
Aaa ped-16-Unsupervised Learning: clustering
 
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
 
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
 
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
 
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
 
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
 
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
 
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
 
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
 
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
 
Aaa ped-5-Data manipulation: Pandas
Aaa ped-5-Data manipulation: Pandas Aaa ped-5-Data manipulation: Pandas
Aaa ped-5-Data manipulation: Pandas
 
Aaa ped-4- Data manipulation: Numpy
Aaa ped-4- Data manipulation: Numpy Aaa ped-4- Data manipulation: Numpy
Aaa ped-4- Data manipulation: Numpy
 
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
 

Recently uploaded

Orientation, design and principles of polyhouse
Orientation, design and principles of polyhouseOrientation, design and principles of polyhouse
Orientation, design and principles of polyhousejana861314
 
GFP in rDNA Technology (Biotechnology).pptx
GFP in rDNA Technology (Biotechnology).pptxGFP in rDNA Technology (Biotechnology).pptx
GFP in rDNA Technology (Biotechnology).pptxAleenaTreesaSaji
 
Pests of cotton_Sucking_Pests_Dr.UPR.pdf
Pests of cotton_Sucking_Pests_Dr.UPR.pdfPests of cotton_Sucking_Pests_Dr.UPR.pdf
Pests of cotton_Sucking_Pests_Dr.UPR.pdfPirithiRaju
 
Labelling Requirements and Label Claims for Dietary Supplements and Recommend...
Labelling Requirements and Label Claims for Dietary Supplements and Recommend...Labelling Requirements and Label Claims for Dietary Supplements and Recommend...
Labelling Requirements and Label Claims for Dietary Supplements and Recommend...Lokesh Kothari
 
PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...
PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...
PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...Sérgio Sacani
 
Presentation Vikram Lander by Vedansh Gupta.pptx
Presentation Vikram Lander by Vedansh Gupta.pptxPresentation Vikram Lander by Vedansh Gupta.pptx
Presentation Vikram Lander by Vedansh Gupta.pptxgindu3009
 
Chromatin Structure | EUCHROMATIN | HETEROCHROMATIN
Chromatin Structure | EUCHROMATIN | HETEROCHROMATINChromatin Structure | EUCHROMATIN | HETEROCHROMATIN
Chromatin Structure | EUCHROMATIN | HETEROCHROMATINsankalpkumarsahoo174
 
Zoology 4th semester series (krishna).pdf
Zoology 4th semester series (krishna).pdfZoology 4th semester series (krishna).pdf
Zoology 4th semester series (krishna).pdfSumit Kumar yadav
 
Spermiogenesis or Spermateleosis or metamorphosis of spermatid
Spermiogenesis or Spermateleosis or metamorphosis of spermatidSpermiogenesis or Spermateleosis or metamorphosis of spermatid
Spermiogenesis or Spermateleosis or metamorphosis of spermatidSarthak Sekhar Mondal
 
Broad bean, Lima Bean, Jack bean, Ullucus.pptx
Broad bean, Lima Bean, Jack bean, Ullucus.pptxBroad bean, Lima Bean, Jack bean, Ullucus.pptx
Broad bean, Lima Bean, Jack bean, Ullucus.pptxjana861314
 
VIRUSES structure and classification ppt by Dr.Prince C P
VIRUSES structure and classification ppt by Dr.Prince C PVIRUSES structure and classification ppt by Dr.Prince C P
VIRUSES structure and classification ppt by Dr.Prince C PPRINCE C P
 
Nightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43b
Nightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43bNightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43b
Nightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43bSérgio Sacani
 
Discovery of an Accretion Streamer and a Slow Wide-angle Outflow around FUOri...
Discovery of an Accretion Streamer and a Slow Wide-angle Outflow around FUOri...Discovery of an Accretion Streamer and a Slow Wide-angle Outflow around FUOri...
Discovery of an Accretion Streamer and a Slow Wide-angle Outflow around FUOri...Sérgio Sacani
 
Chemistry 4th semester series (krishna).pdf
Chemistry 4th semester series (krishna).pdfChemistry 4th semester series (krishna).pdf
Chemistry 4th semester series (krishna).pdfSumit Kumar yadav
 
Biopesticide (2).pptx .This slides helps to know the different types of biop...
Biopesticide (2).pptx  .This slides helps to know the different types of biop...Biopesticide (2).pptx  .This slides helps to know the different types of biop...
Biopesticide (2).pptx .This slides helps to know the different types of biop...RohitNehra6
 
TEST BANK For Radiologic Science for Technologists, 12th Edition by Stewart C...
TEST BANK For Radiologic Science for Technologists, 12th Edition by Stewart C...TEST BANK For Radiologic Science for Technologists, 12th Edition by Stewart C...
TEST BANK For Radiologic Science for Technologists, 12th Edition by Stewart C...ssifa0344
 
Raman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral Analysis
Raman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral AnalysisRaman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral Analysis
Raman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral AnalysisDiwakar Mishra
 
DIFFERENCE IN BACK CROSS AND TEST CROSS
DIFFERENCE IN  BACK CROSS AND TEST CROSSDIFFERENCE IN  BACK CROSS AND TEST CROSS
DIFFERENCE IN BACK CROSS AND TEST CROSSLeenakshiTyagi
 
Traditional Agroforestry System in India- Shifting Cultivation, Taungya, Home...
Traditional Agroforestry System in India- Shifting Cultivation, Taungya, Home...Traditional Agroforestry System in India- Shifting Cultivation, Taungya, Home...
Traditional Agroforestry System in India- Shifting Cultivation, Taungya, Home...jana861314
 
Recombinant DNA technology (Immunological screening)
Recombinant DNA technology (Immunological screening)Recombinant DNA technology (Immunological screening)
Recombinant DNA technology (Immunological screening)PraveenaKalaiselvan1
 

Recently uploaded (20)

Orientation, design and principles of polyhouse
Orientation, design and principles of polyhouseOrientation, design and principles of polyhouse
Orientation, design and principles of polyhouse
 
GFP in rDNA Technology (Biotechnology).pptx
GFP in rDNA Technology (Biotechnology).pptxGFP in rDNA Technology (Biotechnology).pptx
GFP in rDNA Technology (Biotechnology).pptx
 
Pests of cotton_Sucking_Pests_Dr.UPR.pdf
Pests of cotton_Sucking_Pests_Dr.UPR.pdfPests of cotton_Sucking_Pests_Dr.UPR.pdf
Pests of cotton_Sucking_Pests_Dr.UPR.pdf
 
Labelling Requirements and Label Claims for Dietary Supplements and Recommend...
Labelling Requirements and Label Claims for Dietary Supplements and Recommend...Labelling Requirements and Label Claims for Dietary Supplements and Recommend...
Labelling Requirements and Label Claims for Dietary Supplements and Recommend...
 
PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...
PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...
PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...
 
Presentation Vikram Lander by Vedansh Gupta.pptx
Presentation Vikram Lander by Vedansh Gupta.pptxPresentation Vikram Lander by Vedansh Gupta.pptx
Presentation Vikram Lander by Vedansh Gupta.pptx
 
Chromatin Structure | EUCHROMATIN | HETEROCHROMATIN
Chromatin Structure | EUCHROMATIN | HETEROCHROMATINChromatin Structure | EUCHROMATIN | HETEROCHROMATIN
Chromatin Structure | EUCHROMATIN | HETEROCHROMATIN
 
Zoology 4th semester series (krishna).pdf
Zoology 4th semester series (krishna).pdfZoology 4th semester series (krishna).pdf
Zoology 4th semester series (krishna).pdf
 
Spermiogenesis or Spermateleosis or metamorphosis of spermatid
Spermiogenesis or Spermateleosis or metamorphosis of spermatidSpermiogenesis or Spermateleosis or metamorphosis of spermatid
Spermiogenesis or Spermateleosis or metamorphosis of spermatid
 
Broad bean, Lima Bean, Jack bean, Ullucus.pptx
Broad bean, Lima Bean, Jack bean, Ullucus.pptxBroad bean, Lima Bean, Jack bean, Ullucus.pptx
Broad bean, Lima Bean, Jack bean, Ullucus.pptx
 
VIRUSES structure and classification ppt by Dr.Prince C P
VIRUSES structure and classification ppt by Dr.Prince C PVIRUSES structure and classification ppt by Dr.Prince C P
VIRUSES structure and classification ppt by Dr.Prince C P
 
Nightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43b
Nightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43bNightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43b
Nightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43b
 
Discovery of an Accretion Streamer and a Slow Wide-angle Outflow around FUOri...
Discovery of an Accretion Streamer and a Slow Wide-angle Outflow around FUOri...Discovery of an Accretion Streamer and a Slow Wide-angle Outflow around FUOri...
Discovery of an Accretion Streamer and a Slow Wide-angle Outflow around FUOri...
 
Chemistry 4th semester series (krishna).pdf
Chemistry 4th semester series (krishna).pdfChemistry 4th semester series (krishna).pdf
Chemistry 4th semester series (krishna).pdf
 
Biopesticide (2).pptx .This slides helps to know the different types of biop...
Biopesticide (2).pptx  .This slides helps to know the different types of biop...Biopesticide (2).pptx  .This slides helps to know the different types of biop...
Biopesticide (2).pptx .This slides helps to know the different types of biop...
 
TEST BANK For Radiologic Science for Technologists, 12th Edition by Stewart C...
TEST BANK For Radiologic Science for Technologists, 12th Edition by Stewart C...TEST BANK For Radiologic Science for Technologists, 12th Edition by Stewart C...
TEST BANK For Radiologic Science for Technologists, 12th Edition by Stewart C...
 
Raman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral Analysis
Raman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral AnalysisRaman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral Analysis
Raman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral Analysis
 
DIFFERENCE IN BACK CROSS AND TEST CROSS
DIFFERENCE IN  BACK CROSS AND TEST CROSSDIFFERENCE IN  BACK CROSS AND TEST CROSS
DIFFERENCE IN BACK CROSS AND TEST CROSS
 
Traditional Agroforestry System in India- Shifting Cultivation, Taungya, Home...
Traditional Agroforestry System in India- Shifting Cultivation, Taungya, Home...Traditional Agroforestry System in India- Shifting Cultivation, Taungya, Home...
Traditional Agroforestry System in India- Shifting Cultivation, Taungya, Home...
 
Recombinant DNA technology (Immunological screening)
Recombinant DNA technology (Immunological screening)Recombinant DNA technology (Immunological screening)
Recombinant DNA technology (Immunological screening)
 

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.