SlideShare a Scribd company logo
Course Notes
PYTHON
PROGRAMMER
⇢ Data Science
⇢ Machine Learning
⇢ Data Visualizations
⇢ Data Applications
⇢ Web Development
Python is good for:
⇢ A lot of job opportunities
⇢ Large Python community
⇢ Cross platform
⇢ Completely Free
⇢ A lot of built-in functionalities
More benefits:
⇢ Academia
⇢ Industry
Python is used in:
Why Python?
3 Steps Python Installation
Supported by a vibrant community of open-source contributors, Anaconda Distribution is the tool of
choice for solo data scientists and machine learning enthusiast, who want to use Python for scientific
computing projects.
01
02
03
Click on Download
Step 2
Choose Python 3 version
Step 3
Go to www.anaconda.com
Step 1
Introducing Spider
Integrated Development Environment
It has:
⇢ Source code area
⇢ Highlighted syntaxis
⇢ A place for running code
IDE
Contains:
⇢ File editor
⇢ IPython Console
⇢ Variable explorer, File explorer and Help box
Spyder
Spyder is a powerful scientific environment written in Python, for Python, and designed by and for
scientists, engineers and data analysts. It offers a unique combination of the advanced editing,
analysis, debugging, and profiling functionality of a comprehensive development tool with the data
exploration, interactive execution, deep inspection, and beautiful visualization capabilities of a
scientific package.
Beyond its many built-in features, its abilities can be extended even further via its plugin system
and API. Furthermore, Spyder can also be used as a PyQt5 extension library, allowing developers to
build upon its functionality and embed its components, such as the interactive console, in their own
PyQt software
Printing in a Nutshell
In Jupyter and Spyder, the last line in the input field is returned as an output (if there is anything to display).
Therefore to display an operation we can either write as the last line in the input field or use the print function.
Name error ⇢ always indicate the
string of characters with single or
double quotation marks
(Word)
(Hi) end=’ ’
Defines an end character for a string .
By default the end character is a new line.
end=’ ’
Always gives a decimal
number called Floating
Point Number (Float)
Forward Slash
/ //
Always gives an integer value
and discards the decimal part
2 Forward Slashes
**
To the power of
2 Asterisks
’ ’
Creates a string
Single Quotation Marks
clear
Clears the console.
Clear
Python Syntax
Whenever we are dealing with the print ( ) function,
we can force the display of the operations
If we are printing a string, we’ve got some some extra
characters to help us
n
New line
Backward Slash + n
t
Indents the text,
Tab command
Backward Slash + t

Escapes the following
character.
Backward Slash
Variables: General Rules
Variables can’t start
with number.
We can’t have space
in a variable’s name.
! However, we can
have underscores.
01
02
We can change
variable’s values.
03
Giving the variables
sensible names is a
good practice.
04
A variable can be set
equal to a string.
(String concatenation)
05
Asking the computer for more space in the main memory
1x=3
new_variable = 3
z = x + y
z = x - y
area=pi*radius**2
phrase_1 + phrase_2
Strings: Input Function
Allows you to get user’s input
Keywords:
Returns the type of a value
⇢ str = string
⇢ int = integer
Input(’string’)
The user is
requested to
make an input
If we press “Enter” ⇢
The input function has
finished running
They are not allowed to be
used as variables names.
To access the list with the
keywords, type in the console:
⇢ help ()
⇢ keywords
Type:
Symbol: #
⇢ highlight the area
⇢ right click
⇢ Comment/Uncomment
NB:
Comment/Uncomment:
Conditionals: Boolean Expressions
Conditionals are what allow computers to make decisions based on the value of variables.
Python can check weather a statement is true or false.
Conditionals in real life
Example
Don’t
Buy
IF
Don’t have
money
Have
money
Buy
IF
Want
Don’t
Want
==
!=
<=
>=
Checking for equality
Not equal to
Less than or equal to
Grater than or equal to
Logical operators
If both conditions are satisfied
⇢ True
And
Or
Negates the result of the condition
Not True ⇢ False
Not False ⇢ True
Not
AND
OR
NOT
Logical operators chain Boolean expressions together to give a particular result
If only one variable satisfies the condition
⇢ True
Is 15 < 22 or 22 < 22 ⇢ True
is 15 < 22 and 20 < 22 ⇢ True
not( 20 < 22 and 25 < 22) ⇢ True
not( 20 < 22 or 25 < 22) ⇢ False
If Statement
Python supports the usual logical conditions from mathematics.
These conditions can be used in several ways, most commonly in "if statements" and loops.
some_condition = False
if some_condition:
print(‘The variable ‘some_condition’ is True’)
else:
print(‘The variable ‘some_condition’ is False’)
Our variable
If statement
Else statement
NB: You can use elif
statement if you want
to check more than
one condition
Meaning: If this condition
evaluates to True, then
print the following line of
code.
Meaning: In every
other case, print
something else
If, else and print
are colored in blue,
because they are
keywords.
More on strings
This is how string indexing from a coding perspective looks like.
len(my_string)
my_string[0]
my_string[1:4]
NB:
1. Python is a zero-
indexing program language
This means that Python starts
counting from 0 and that’s why
if we type [1] – Python will give
us the letter Y.
2. In Python:
‘n’ == ‘N’
False
P Y T H O N
1 2 3 4 5
0 6
Shows the length of the string
Python = 6 (It has 6 letters)
Meaning: From this string, please give me the first character
Python = P
Meaning: Give me access to group of letters that start at the
first index to the fourth
Python = yth
Our variable: my_string
⇢ It points to a space in the main memory.
⇢ That space contains the string Python
⇢ Each of Python’ s letters has its own unique space
⇢ We can access these letters by using the index numbers ⇢
my_string.upper ( )
Capitalizes all letters. Lower makes all letters lower case.
Lists and Loops
Code Block Run
Repeat Tasks
(Loop)
</>
END
Types of Loops:
For Loops ⇢ Repeat a certain number of times
While Loops ⇢ Repeat based on a condition (True/False)
1
2
Computers are good at doing repetitive tasks quickly
NB:
Incrementing values:
Changing the value of a variable
List Example:
m y _ l i s t = [ 3 4 , 7 6 , 5 8 ]
Common List Methods
It appends the desired value at
the end of the list
Append
It reverses the
order of the list
Reverse
This method shows the
index of the value
Index
Similar to Append. We can add
a whole new list to the current
list.
Extend
Removes values
from the list
Remove
*It could be useful in For Loops
If you write the name of the variable (e.g. my_list) and
then type . (dot) all of the methods that are available
will appear.
Modolo Operator
11 % 2
Result: 1
Modulus gives you the remainder
of the result of the division
It’s denoted by the % sign
m y _ l i s t .

More Related Content

Similar to 1_1_python-course-notes-sections-1-7.pdf (20)

PDF
1_Python Basics.pdf
MaheshGour5
 
PPTX
unit1.pptx for python programming CSE department
rickyghoshiit
 
PPTX
Python programing
hamzagame
 
DOCX
C# language basics (Visual Studio)
rnkhan
 
DOCX
C# language basics (Visual studio)
rnkhan
 
PPTX
Chapter 2-Python and control flow statement.pptx
atharvdeshpande20
 
PPTX
Basic of Python- Hands on Session
Dharmesh Tank
 
PPTX
lecture 2.pptx
Anonymous9etQKwW
 
PPTX
Bikalpa_Thapa_Python_Programming_(Basics).pptx
Bikalpa Thapa
 
PPTX
Python knowledge ,......................
sabith777a
 
PPT
Control structures pyhton
Prakash Jayaraman
 
PPTX
“Python” or “CPython” is written in C/C+
Mukeshpanigrahy1
 
PPT
introduction to python in english presentation file
RujanTimsina1
 
PPTX
Introduction To Python.pptx
Anum Zehra
 
PPTX
Teach The Nation To Code.pptx
HermonYohannes2
 
PPTX
Python programming
Ashwin Kumar Ramasamy
 
PPTX
Pseudocode
Harsha Madushanka
 
PDF
GE3151 UNIT II Study material .pdf
Guru Nanak Technical Institutions
 
PPTX
Chapter1 python introduction syntax general
ssuser77162c
 
PPTX
Chapter08.pptx
GiannisPagges
 
1_Python Basics.pdf
MaheshGour5
 
unit1.pptx for python programming CSE department
rickyghoshiit
 
Python programing
hamzagame
 
C# language basics (Visual Studio)
rnkhan
 
C# language basics (Visual studio)
rnkhan
 
Chapter 2-Python and control flow statement.pptx
atharvdeshpande20
 
Basic of Python- Hands on Session
Dharmesh Tank
 
lecture 2.pptx
Anonymous9etQKwW
 
Bikalpa_Thapa_Python_Programming_(Basics).pptx
Bikalpa Thapa
 
Python knowledge ,......................
sabith777a
 
Control structures pyhton
Prakash Jayaraman
 
“Python” or “CPython” is written in C/C+
Mukeshpanigrahy1
 
introduction to python in english presentation file
RujanTimsina1
 
Introduction To Python.pptx
Anum Zehra
 
Teach The Nation To Code.pptx
HermonYohannes2
 
Python programming
Ashwin Kumar Ramasamy
 
Pseudocode
Harsha Madushanka
 
GE3151 UNIT II Study material .pdf
Guru Nanak Technical Institutions
 
Chapter1 python introduction syntax general
ssuser77162c
 
Chapter08.pptx
GiannisPagges
 

More from Javier Crisostomo (6)

PDF
Java Programming 100 Programming Challenges
Javier Crisostomo
 
PDF
Complete JavaScript Guide Notes Examples
Javier Crisostomo
 
PPT
3212191.ppt
Javier Crisostomo
 
PDF
clasen01tgs-230326082207-a8d5a7b3.pdf
Javier Crisostomo
 
PDF
6_1_course-notes-deep-nets-overview.pdf
Javier Crisostomo
 
PDF
1658897215230.pdf
Javier Crisostomo
 
Java Programming 100 Programming Challenges
Javier Crisostomo
 
Complete JavaScript Guide Notes Examples
Javier Crisostomo
 
3212191.ppt
Javier Crisostomo
 
clasen01tgs-230326082207-a8d5a7b3.pdf
Javier Crisostomo
 
6_1_course-notes-deep-nets-overview.pdf
Javier Crisostomo
 
1658897215230.pdf
Javier Crisostomo
 
Ad

Recently uploaded (20)

PDF
JavaScript - Good or Bad? Tips for Google Tag Manager
📊 Markus Baersch
 
PPT
tuberculosiship-2106031cyyfuftufufufivifviviv
AkshaiRam
 
PDF
Merits and Demerits of DBMS over File System & 3-Tier Architecture in DBMS
MD RIZWAN MOLLA
 
PDF
OPPOTUS - Malaysias on Malaysia 1Q2025.pdf
Oppotus
 
PDF
Product Management in HealthTech (Case Studies from SnappDoctor)
Hamed Shams
 
PPTX
Listify-Intelligent-Voice-to-Catalog-Agent.pptx
nareshkottees
 
PDF
Data Chunking Strategies for RAG in 2025.pdf
Tamanna
 
PDF
Choosing the Right Database for Indexing.pdf
Tamanna
 
PDF
What does good look like - CRAP Brighton 8 July 2025
Jan Kierzyk
 
PDF
Driving Employee Engagement in a Hybrid World.pdf
Mia scott
 
PDF
The European Business Wallet: Why It Matters and How It Powers the EUDI Ecosy...
Lal Chandran
 
PDF
Simplifying Document Processing with Docling for AI Applications.pdf
Tamanna
 
PPTX
b6057ea5-8e8c-4415-90c0-ed8e9666ffcd.pptx
Anees487379
 
PPT
Growth of Public Expendituuure_55423.ppt
NavyaDeora
 
PDF
Copia de Strategic Roadmap Infographics by Slidesgo.pptx (1).pdf
ssuserd4c6911
 
PDF
OOPs with Java_unit2.pdf. sarthak bookkk
Sarthak964187
 
PPTX
apidays Helsinki & North 2025 - Agentic AI: A Friend or Foe?, Merja Kajava (A...
apidays
 
PPTX
ER_Model_with_Diagrams_Presentation.pptx
dharaadhvaryu1992
 
PPTX
apidays Singapore 2025 - Designing for Change, Julie Schiller (Google)
apidays
 
PPTX
Exploring Multilingual Embeddings for Italian Semantic Search: A Pretrained a...
Sease
 
JavaScript - Good or Bad? Tips for Google Tag Manager
📊 Markus Baersch
 
tuberculosiship-2106031cyyfuftufufufivifviviv
AkshaiRam
 
Merits and Demerits of DBMS over File System & 3-Tier Architecture in DBMS
MD RIZWAN MOLLA
 
OPPOTUS - Malaysias on Malaysia 1Q2025.pdf
Oppotus
 
Product Management in HealthTech (Case Studies from SnappDoctor)
Hamed Shams
 
Listify-Intelligent-Voice-to-Catalog-Agent.pptx
nareshkottees
 
Data Chunking Strategies for RAG in 2025.pdf
Tamanna
 
Choosing the Right Database for Indexing.pdf
Tamanna
 
What does good look like - CRAP Brighton 8 July 2025
Jan Kierzyk
 
Driving Employee Engagement in a Hybrid World.pdf
Mia scott
 
The European Business Wallet: Why It Matters and How It Powers the EUDI Ecosy...
Lal Chandran
 
Simplifying Document Processing with Docling for AI Applications.pdf
Tamanna
 
b6057ea5-8e8c-4415-90c0-ed8e9666ffcd.pptx
Anees487379
 
Growth of Public Expendituuure_55423.ppt
NavyaDeora
 
Copia de Strategic Roadmap Infographics by Slidesgo.pptx (1).pdf
ssuserd4c6911
 
OOPs with Java_unit2.pdf. sarthak bookkk
Sarthak964187
 
apidays Helsinki & North 2025 - Agentic AI: A Friend or Foe?, Merja Kajava (A...
apidays
 
ER_Model_with_Diagrams_Presentation.pptx
dharaadhvaryu1992
 
apidays Singapore 2025 - Designing for Change, Julie Schiller (Google)
apidays
 
Exploring Multilingual Embeddings for Italian Semantic Search: A Pretrained a...
Sease
 
Ad

1_1_python-course-notes-sections-1-7.pdf

  • 2. ⇢ Data Science ⇢ Machine Learning ⇢ Data Visualizations ⇢ Data Applications ⇢ Web Development Python is good for: ⇢ A lot of job opportunities ⇢ Large Python community ⇢ Cross platform ⇢ Completely Free ⇢ A lot of built-in functionalities More benefits: ⇢ Academia ⇢ Industry Python is used in: Why Python?
  • 3. 3 Steps Python Installation Supported by a vibrant community of open-source contributors, Anaconda Distribution is the tool of choice for solo data scientists and machine learning enthusiast, who want to use Python for scientific computing projects. 01 02 03 Click on Download Step 2 Choose Python 3 version Step 3 Go to www.anaconda.com Step 1
  • 4. Introducing Spider Integrated Development Environment It has: ⇢ Source code area ⇢ Highlighted syntaxis ⇢ A place for running code IDE Contains: ⇢ File editor ⇢ IPython Console ⇢ Variable explorer, File explorer and Help box Spyder Spyder is a powerful scientific environment written in Python, for Python, and designed by and for scientists, engineers and data analysts. It offers a unique combination of the advanced editing, analysis, debugging, and profiling functionality of a comprehensive development tool with the data exploration, interactive execution, deep inspection, and beautiful visualization capabilities of a scientific package. Beyond its many built-in features, its abilities can be extended even further via its plugin system and API. Furthermore, Spyder can also be used as a PyQt5 extension library, allowing developers to build upon its functionality and embed its components, such as the interactive console, in their own PyQt software
  • 5. Printing in a Nutshell In Jupyter and Spyder, the last line in the input field is returned as an output (if there is anything to display). Therefore to display an operation we can either write as the last line in the input field or use the print function. Name error ⇢ always indicate the string of characters with single or double quotation marks (Word) (Hi) end=’ ’ Defines an end character for a string . By default the end character is a new line. end=’ ’ Always gives a decimal number called Floating Point Number (Float) Forward Slash / // Always gives an integer value and discards the decimal part 2 Forward Slashes ** To the power of 2 Asterisks ’ ’ Creates a string Single Quotation Marks clear Clears the console. Clear Python Syntax Whenever we are dealing with the print ( ) function, we can force the display of the operations If we are printing a string, we’ve got some some extra characters to help us n New line Backward Slash + n t Indents the text, Tab command Backward Slash + t Escapes the following character. Backward Slash
  • 6. Variables: General Rules Variables can’t start with number. We can’t have space in a variable’s name. ! However, we can have underscores. 01 02 We can change variable’s values. 03 Giving the variables sensible names is a good practice. 04 A variable can be set equal to a string. (String concatenation) 05 Asking the computer for more space in the main memory 1x=3 new_variable = 3 z = x + y z = x - y area=pi*radius**2 phrase_1 + phrase_2
  • 7. Strings: Input Function Allows you to get user’s input Keywords: Returns the type of a value ⇢ str = string ⇢ int = integer Input(’string’) The user is requested to make an input If we press “Enter” ⇢ The input function has finished running They are not allowed to be used as variables names. To access the list with the keywords, type in the console: ⇢ help () ⇢ keywords Type: Symbol: # ⇢ highlight the area ⇢ right click ⇢ Comment/Uncomment NB: Comment/Uncomment:
  • 8. Conditionals: Boolean Expressions Conditionals are what allow computers to make decisions based on the value of variables. Python can check weather a statement is true or false. Conditionals in real life Example Don’t Buy IF Don’t have money Have money Buy IF Want Don’t Want == != <= >= Checking for equality Not equal to Less than or equal to Grater than or equal to
  • 9. Logical operators If both conditions are satisfied ⇢ True And Or Negates the result of the condition Not True ⇢ False Not False ⇢ True Not AND OR NOT Logical operators chain Boolean expressions together to give a particular result If only one variable satisfies the condition ⇢ True Is 15 < 22 or 22 < 22 ⇢ True is 15 < 22 and 20 < 22 ⇢ True not( 20 < 22 and 25 < 22) ⇢ True not( 20 < 22 or 25 < 22) ⇢ False
  • 10. If Statement Python supports the usual logical conditions from mathematics. These conditions can be used in several ways, most commonly in "if statements" and loops. some_condition = False if some_condition: print(‘The variable ‘some_condition’ is True’) else: print(‘The variable ‘some_condition’ is False’) Our variable If statement Else statement NB: You can use elif statement if you want to check more than one condition Meaning: If this condition evaluates to True, then print the following line of code. Meaning: In every other case, print something else If, else and print are colored in blue, because they are keywords.
  • 11. More on strings This is how string indexing from a coding perspective looks like. len(my_string) my_string[0] my_string[1:4] NB: 1. Python is a zero- indexing program language This means that Python starts counting from 0 and that’s why if we type [1] – Python will give us the letter Y. 2. In Python: ‘n’ == ‘N’ False P Y T H O N 1 2 3 4 5 0 6 Shows the length of the string Python = 6 (It has 6 letters) Meaning: From this string, please give me the first character Python = P Meaning: Give me access to group of letters that start at the first index to the fourth Python = yth Our variable: my_string ⇢ It points to a space in the main memory. ⇢ That space contains the string Python ⇢ Each of Python’ s letters has its own unique space ⇢ We can access these letters by using the index numbers ⇢ my_string.upper ( ) Capitalizes all letters. Lower makes all letters lower case.
  • 12. Lists and Loops Code Block Run Repeat Tasks (Loop) </> END Types of Loops: For Loops ⇢ Repeat a certain number of times While Loops ⇢ Repeat based on a condition (True/False) 1 2 Computers are good at doing repetitive tasks quickly NB: Incrementing values: Changing the value of a variable List Example: m y _ l i s t = [ 3 4 , 7 6 , 5 8 ]
  • 13. Common List Methods It appends the desired value at the end of the list Append It reverses the order of the list Reverse This method shows the index of the value Index Similar to Append. We can add a whole new list to the current list. Extend Removes values from the list Remove *It could be useful in For Loops If you write the name of the variable (e.g. my_list) and then type . (dot) all of the methods that are available will appear. Modolo Operator 11 % 2 Result: 1 Modulus gives you the remainder of the result of the division It’s denoted by the % sign m y _ l i s t .