SlideShare a Scribd company logo
1 of 14
www.elewayte.com
GET READY TO SSSSSSINK
INTO PYTHON BASICS,
ITS POWER & VERSATILITY
iNTRODUCTION
TO PYTHON
Python is a high-level programming
language that is widely used in various
fields, including data
science, web development, and artificial
intelligence. Some of the key elements of
Python include:
01
DATA TYPES
02
VARIABLES
03
OPERATORS
04
CONDITIONAL
STATEMENTS
05
LOOPS
06
FUNCTIONS
07
LIBRARIES
Data Types:
So Many Flavors, So
Little Time!
In Python, data types are categories of
values that determine how the values
behave and what operations can be
performed on them. Here are some
common data types and their examples:
TYPES DESCRIPTION EXAMPLES
Numeric
Represents numerical
values
'int' , 'float' , 'complex'
Sequence
Represents a collection of
ordered and indexed values
'list' , 'tuple' , 'range'
Text
Represents a sequence of
characters
'str'
Mapping
Represents a collection of
key-value pairs
'dict'
Set
Represents a collection of
unique elements
'set' , 'frozenset'
Boolean
Represents a binary truth
value
'bool'
Binary Represents binary data
'bytes' , 'bytearray' ,
'memoryview'
Examples that shows how different data types can be used in
Python:
Variables:
Party Time! Get
Your Data On!
A variable in Python is just a name that
represents a value, and you can use it to
store and manipulate data throughout
your program.
Let’s understand the same with a small
example:
In Python, we’ll try to create a variable called "age" and
assign a value to it, like this:
Now, whenever you need to use that age value in your
program, you can just use the variable name "age". For
example:
The output will be:
In this example, the variable "age" is assigned the value 15.
Then, the print statement uses the value of the variable
"age" to output the string "I am 15 years old."
Note: We use the str() function to convert the integer value
of "age" into a string, so we can concatenate it with the
other strings in the output statement.
Operators:
Go crazy with
Calculations!
In Python, operators are symbols or
special characters that allow you to
perform different kinds of operations on
variables and values.
Here's a table that summarizes the
different types of operators in Python,
along with their descriptions and
examples:
TYPES DESCRIPTION EXAMPLES
Arithmetic
Operators
Used to perform arithmetic
operations
'2 + 3' returns '5'
Comparison
Operators
Used to compare
values
'2 < 3' returns 'True'
Logical
Operators
Used to combine and
manipulate boolean values
'True and False' returns
'False'
Bitwise
Operators
Used to perform
bitwise operations
'5 & 3' returns '1'
Assignment
Operators
Used to assign values
to variables
'x=5'
Identity
Operators
Used to compare the
memory location of
two objects
'x is y' returns 'True'
Membership
Operators
Used to check if a
value is present in a
sequence
'2 in [1, 2, 3]' return 'True'
Conditional
Statements:
Be the boss of your
code!
Conditional statements in allow you to control
the flow of your program based on certain
conditions. They are used to make decisions in
your code, and they help your program to be
more flexible and responsive to different inputs.
Here's a detailed description along with
examples that demonstrates the different types
of conditional statements in Python to perform
various kinds of checks, such as checking if a
number is greater than a certain value, or if it
falls within a certain range. When you run this
code, you will see the output for each
conditional statement.
TYPES DESCRIPTION EXAMPLES
If
statement
Executes a block
of code if a condition
is true
'x=5' <br>
'if x>3:'<br>
'print("x is greater than 3")'
If else
statement
Executes one block
of code if a condition
is true and another
block if it is false
'x=2' <br>
'if x>3: '<br>
'print("x is greater than 3")' <br>
'else:' <br>
'print("x is less than or equal to 3")'
elif
statement
Executes a block of
code if a condition is true,
and if not, checks
another condition
'x = 5' <br>
'if x > 7: ' <br>
'print("x is
greater than 7")' <br>
'elif x > 3: '<br>
'print("x is greater than 3 but less
than or equal to 7")' <br>
'else:' <br>
'print("x is less than or equal to 3")'
nested if
statement
Executes a block of
code if a condition is true,
and that block
can contain another
if statement
'x = 5' <br>
'if x > 3:' <br>
'if x < 7:' <br>
'print("x is between 3 and7")' <br>
'else:' <br>
'print("x is greater than or equal to 7")' <br>
'else:'<br>
'print("x is less than or equal to 3")'
Loops:
Repeat After Me!
Loops are used to repeat a block of code multiple
times until a certain condition is met. There are
two main types of loops in Python: for loops and
while loops.
Here's an example of a for loop that iterates over
a list of numbers and prints each number along
with the output. In this example, the loop will
continue to run as long as count is greater than
0. Each time the loop runs, it prints the value of
count, then subtracts 1 from it. Eventually, count
becomes 0, and the loop stops running.
There are also other types of loops in Python,
such as nested loops, which allow you to put one
loop inside another, and break and continue
statements, which allow you to control the flow
of the loop.
INPUT OUTPUT
FOR
LOOP
LOOP TYPE DESCRIPTION
'for' loop
Used to iterate over a sequence of elements,
such as a list or string
'while' loop
Used to repeat a block of code while a certain
condition is true
WHILE
LOOP
FUNCTION TYPE DESCRIPTION
Built-in
functions
Functions that are built in python and can be
used without needing to define them.
Examples - 'print()' , 'len()' and 'range()'
User-defined
functions
Functions that you create yourself to perform
a specific task. They can be reused multiple
times throughout your code.
Functions:
The Superheroes
of Code!
Functions are reusable blocks of code that perform
a specific task. They allow you to write a piece of
code once and use it multiple times without having
to rewrite the code. There are two main types of
functions in Python: built-in functions and user-
defined functions.
In this example, we define a function called
add_numbers() that takes two parameters, a and b.
The function adds a and b together and returns the
sum. We then call the function with the values 2
and 3, which returns 5. Finally, we print the result.
INPUT OUTPUT
Built-in
function
User-
defined
function
Functions
Continue...
Here's an example of using the math library to
calculate the square root of a number:
Another example is using the pandas library to
read a CSV file and display its contents:
Python's Top Guns:
The Most Important
Libraries
1. NumPy
NumPy is a library for numerical computing in
Python. It provides fast and efficient array
operations and linear algebra routines.
2. Pandas
Pandas is a library for data manipulation
and analysis in Python. It provides
powerful tools for working with structured
data, such as dataframes and series.
Example for importing NumPy
Library in Python
Example for importing Pandas
Library in Python
Libraries
Continue...
Matplotlib is a library for data visualization
in Python. It provides a variety of plots and
charts for visualizing data, including line
plots, scatter plots, and histograms.
Scikit-learn is a library for machine
learning in Python. It provides tools for
data preprocessing, model selection, and
evaluation, as well as a range of machine
learning algorithms.
Example for importing
Matplotlib Library in Python
Example for importing Scikit-
learn library in Python
3. Matplotlib
4. Scikit-learn
FOLLOW FOR MORE
SUCH CONTENTS
www.elewayte.com
elewayte_edu Elewayte Elewayte
elewayte_

More Related Content

What's hot

Python 3 Programming Language
Python 3 Programming LanguagePython 3 Programming Language
Python 3 Programming LanguageTahani Al-Manie
 
Introduction to Python
Introduction to PythonIntroduction to Python
Introduction to PythonNowell Strite
 
Python Programming ppt
Python Programming pptPython Programming ppt
Python Programming pptismailmrribi
 
Introduction to the basics of Python programming (part 1)
Introduction to the basics of Python programming (part 1)Introduction to the basics of Python programming (part 1)
Introduction to the basics of Python programming (part 1)Pedro Rodrigues
 
Python programming | Fundamentals of Python programming
Python programming | Fundamentals of Python programming Python programming | Fundamentals of Python programming
Python programming | Fundamentals of Python programming KrishnaMildain
 
Variables & Data Types In Python | Edureka
Variables & Data Types In Python | EdurekaVariables & Data Types In Python | Edureka
Variables & Data Types In Python | EdurekaEdureka!
 
Introduction to Python
Introduction to Python Introduction to Python
Introduction to Python amiable_indian
 
Python Crash Course
Python Crash CoursePython Crash Course
Python Crash CourseHaim Michael
 
Python course syllabus
Python course syllabusPython course syllabus
Python course syllabusSugantha T
 
Fundamentals of Python Programming
Fundamentals of Python ProgrammingFundamentals of Python Programming
Fundamentals of Python ProgrammingKamal Acharya
 
Get started python programming part 1
Get started python programming   part 1Get started python programming   part 1
Get started python programming part 1Nicholas I
 

What's hot (20)

Python 3 Programming Language
Python 3 Programming LanguagePython 3 Programming Language
Python 3 Programming Language
 
Python
PythonPython
Python
 
Programming with Python
Programming with PythonProgramming with Python
Programming with Python
 
Python ppt
Python pptPython ppt
Python ppt
 
Introduction to Python
Introduction to PythonIntroduction to Python
Introduction to Python
 
Python Programming ppt
Python Programming pptPython Programming ppt
Python Programming ppt
 
Introduction to the basics of Python programming (part 1)
Introduction to the basics of Python programming (part 1)Introduction to the basics of Python programming (part 1)
Introduction to the basics of Python programming (part 1)
 
Python programming
Python  programmingPython  programming
Python programming
 
Python tutorial
Python tutorialPython tutorial
Python tutorial
 
Python Tutorial Part 1
Python Tutorial Part 1Python Tutorial Part 1
Python Tutorial Part 1
 
Python programming | Fundamentals of Python programming
Python programming | Fundamentals of Python programming Python programming | Fundamentals of Python programming
Python programming | Fundamentals of Python programming
 
Variables & Data Types In Python | Edureka
Variables & Data Types In Python | EdurekaVariables & Data Types In Python | Edureka
Variables & Data Types In Python | Edureka
 
Introduction to Python
Introduction to Python Introduction to Python
Introduction to Python
 
Python
PythonPython
Python
 
Python Crash Course
Python Crash CoursePython Crash Course
Python Crash Course
 
Basics of python
Basics of pythonBasics of python
Basics of python
 
Intro to Python
Intro to PythonIntro to Python
Intro to Python
 
Python course syllabus
Python course syllabusPython course syllabus
Python course syllabus
 
Fundamentals of Python Programming
Fundamentals of Python ProgrammingFundamentals of Python Programming
Fundamentals of Python Programming
 
Get started python programming part 1
Get started python programming   part 1Get started python programming   part 1
Get started python programming part 1
 

Similar to Introduction to Basics of Python

TOPIC-2-Expression Variable Assignment Statement.pdf
TOPIC-2-Expression Variable Assignment Statement.pdfTOPIC-2-Expression Variable Assignment Statement.pdf
TOPIC-2-Expression Variable Assignment Statement.pdfEjazAlam23
 
Python (Data Analysis) cleaning and visualize
Python (Data Analysis) cleaning and visualizePython (Data Analysis) cleaning and visualize
Python (Data Analysis) cleaning and visualizeIruolagbePius
 
Basic data types in python
Basic data types in pythonBasic data types in python
Basic data types in pythonsunilchute1
 
An Introduction : Python
An Introduction : PythonAn Introduction : Python
An Introduction : PythonRaghu Kumar
 
Introduction To Programming with Python-1
Introduction To Programming with Python-1Introduction To Programming with Python-1
Introduction To Programming with Python-1Syed Farjad Zia Zaidi
 
Literals, primitive datatypes, variables, expressions, identifiers
Literals, primitive datatypes, variables, expressions, identifiersLiterals, primitive datatypes, variables, expressions, identifiers
Literals, primitive datatypes, variables, expressions, identifiersTanishq Soni
 
CS 360 LAB 3 STRINGS, FUNCTIONS, AND METHODSObjective The purpos.docx
CS 360 LAB 3 STRINGS, FUNCTIONS, AND METHODSObjective The purpos.docxCS 360 LAB 3 STRINGS, FUNCTIONS, AND METHODSObjective The purpos.docx
CS 360 LAB 3 STRINGS, FUNCTIONS, AND METHODSObjective The purpos.docxfaithxdunce63732
 
FUNDAMENTALS OF PYTHON LANGUAGE
 FUNDAMENTALS OF PYTHON LANGUAGE  FUNDAMENTALS OF PYTHON LANGUAGE
FUNDAMENTALS OF PYTHON LANGUAGE Saraswathi Murugan
 
Python (3).pdf
Python (3).pdfPython (3).pdf
Python (3).pdfsamiwaris2
 
Improve Your Edge on Machine Learning - Day 1.pptx
Improve Your Edge on Machine Learning - Day 1.pptxImprove Your Edge on Machine Learning - Day 1.pptx
Improve Your Edge on Machine Learning - Day 1.pptxCatherineVania1
 
Python_Unit_1.pdf
Python_Unit_1.pdfPython_Unit_1.pdf
Python_Unit_1.pdfalaparthi
 

Similar to Introduction to Basics of Python (20)

TOPIC-2-Expression Variable Assignment Statement.pdf
TOPIC-2-Expression Variable Assignment Statement.pdfTOPIC-2-Expression Variable Assignment Statement.pdf
TOPIC-2-Expression Variable Assignment Statement.pdf
 
Python cheat-sheet
Python cheat-sheetPython cheat-sheet
Python cheat-sheet
 
Python (Data Analysis) cleaning and visualize
Python (Data Analysis) cleaning and visualizePython (Data Analysis) cleaning and visualize
Python (Data Analysis) cleaning and visualize
 
Python revision tour i
Python revision tour iPython revision tour i
Python revision tour i
 
Python 3.pptx
Python 3.pptxPython 3.pptx
Python 3.pptx
 
Python basics
Python basicsPython basics
Python basics
 
Basic data types in python
Basic data types in pythonBasic data types in python
Basic data types in python
 
python
pythonpython
python
 
An Introduction : Python
An Introduction : PythonAn Introduction : Python
An Introduction : Python
 
Introduction To Programming with Python-1
Introduction To Programming with Python-1Introduction To Programming with Python-1
Introduction To Programming with Python-1
 
Literals, primitive datatypes, variables, expressions, identifiers
Literals, primitive datatypes, variables, expressions, identifiersLiterals, primitive datatypes, variables, expressions, identifiers
Literals, primitive datatypes, variables, expressions, identifiers
 
CS 360 LAB 3 STRINGS, FUNCTIONS, AND METHODSObjective The purpos.docx
CS 360 LAB 3 STRINGS, FUNCTIONS, AND METHODSObjective The purpos.docxCS 360 LAB 3 STRINGS, FUNCTIONS, AND METHODSObjective The purpos.docx
CS 360 LAB 3 STRINGS, FUNCTIONS, AND METHODSObjective The purpos.docx
 
Pythonppt28 11-18
Pythonppt28 11-18Pythonppt28 11-18
Pythonppt28 11-18
 
FUNDAMENTALS OF PYTHON LANGUAGE
 FUNDAMENTALS OF PYTHON LANGUAGE  FUNDAMENTALS OF PYTHON LANGUAGE
FUNDAMENTALS OF PYTHON LANGUAGE
 
Python.pptx
Python.pptxPython.pptx
Python.pptx
 
Python
PythonPython
Python
 
Python (3).pdf
Python (3).pdfPython (3).pdf
Python (3).pdf
 
Improve Your Edge on Machine Learning - Day 1.pptx
Improve Your Edge on Machine Learning - Day 1.pptxImprove Your Edge on Machine Learning - Day 1.pptx
Improve Your Edge on Machine Learning - Day 1.pptx
 
Python slide.1
Python slide.1Python slide.1
Python slide.1
 
Python_Unit_1.pdf
Python_Unit_1.pdfPython_Unit_1.pdf
Python_Unit_1.pdf
 

More from Elewayte

Cyber Security Threats Unveilded
Cyber Security Threats UnveildedCyber Security Threats Unveilded
Cyber Security Threats UnveildedElewayte
 
Cracking Interview: The Ultimate Cheat Sheet on Soft Skills
Cracking Interview: The Ultimate Cheat Sheet on Soft SkillsCracking Interview: The Ultimate Cheat Sheet on Soft Skills
Cracking Interview: The Ultimate Cheat Sheet on Soft SkillsElewayte
 
Demystifying Data Science using Python
Demystifying Data Science using PythonDemystifying Data Science using Python
Demystifying Data Science using PythonElewayte
 
Node.js & Express.js Unleashed
Node.js & Express.js UnleashedNode.js & Express.js Unleashed
Node.js & Express.js UnleashedElewayte
 
From Flexbox to Hooks
From Flexbox to HooksFrom Flexbox to Hooks
From Flexbox to HooksElewayte
 
API & Backend Integration
API & Backend IntegrationAPI & Backend Integration
API & Backend IntegrationElewayte
 
Elewayte Cloud Computing Advancements
Elewayte Cloud Computing AdvancementsElewayte Cloud Computing Advancements
Elewayte Cloud Computing AdvancementsElewayte
 
Introduction to 32-Bit Embedded System
Introduction to 32-Bit Embedded SystemIntroduction to 32-Bit Embedded System
Introduction to 32-Bit Embedded SystemElewayte
 
Web Content Management System
Web Content Management SystemWeb Content Management System
Web Content Management SystemElewayte
 
Design Thinking & Back-End Architecture
Design Thinking & Back-End ArchitectureDesign Thinking & Back-End Architecture
Design Thinking & Back-End ArchitectureElewayte
 
Leveraging the Power of Web Development in Digital Marketing
Leveraging the Power of Web Development in Digital MarketingLeveraging the Power of Web Development in Digital Marketing
Leveraging the Power of Web Development in Digital MarketingElewayte
 
The Ultimate Power Bi Tutorial | Elewayte
The Ultimate Power Bi Tutorial | ElewayteThe Ultimate Power Bi Tutorial | Elewayte
The Ultimate Power Bi Tutorial | ElewayteElewayte
 

More from Elewayte (12)

Cyber Security Threats Unveilded
Cyber Security Threats UnveildedCyber Security Threats Unveilded
Cyber Security Threats Unveilded
 
Cracking Interview: The Ultimate Cheat Sheet on Soft Skills
Cracking Interview: The Ultimate Cheat Sheet on Soft SkillsCracking Interview: The Ultimate Cheat Sheet on Soft Skills
Cracking Interview: The Ultimate Cheat Sheet on Soft Skills
 
Demystifying Data Science using Python
Demystifying Data Science using PythonDemystifying Data Science using Python
Demystifying Data Science using Python
 
Node.js & Express.js Unleashed
Node.js & Express.js UnleashedNode.js & Express.js Unleashed
Node.js & Express.js Unleashed
 
From Flexbox to Hooks
From Flexbox to HooksFrom Flexbox to Hooks
From Flexbox to Hooks
 
API & Backend Integration
API & Backend IntegrationAPI & Backend Integration
API & Backend Integration
 
Elewayte Cloud Computing Advancements
Elewayte Cloud Computing AdvancementsElewayte Cloud Computing Advancements
Elewayte Cloud Computing Advancements
 
Introduction to 32-Bit Embedded System
Introduction to 32-Bit Embedded SystemIntroduction to 32-Bit Embedded System
Introduction to 32-Bit Embedded System
 
Web Content Management System
Web Content Management SystemWeb Content Management System
Web Content Management System
 
Design Thinking & Back-End Architecture
Design Thinking & Back-End ArchitectureDesign Thinking & Back-End Architecture
Design Thinking & Back-End Architecture
 
Leveraging the Power of Web Development in Digital Marketing
Leveraging the Power of Web Development in Digital MarketingLeveraging the Power of Web Development in Digital Marketing
Leveraging the Power of Web Development in Digital Marketing
 
The Ultimate Power Bi Tutorial | Elewayte
The Ultimate Power Bi Tutorial | ElewayteThe Ultimate Power Bi Tutorial | Elewayte
The Ultimate Power Bi Tutorial | Elewayte
 

Recently uploaded

Planning a health career 4th Quarter.pptx
Planning a health career 4th Quarter.pptxPlanning a health career 4th Quarter.pptx
Planning a health career 4th Quarter.pptxLigayaBacuel1
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxChelloAnnAsuncion2
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfphamnguyenenglishnb
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomnelietumpap1
 
Romantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxRomantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxsqpmdrvczh
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxDr.Ibrahim Hassaan
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 

Recently uploaded (20)

Planning a health career 4th Quarter.pptx
Planning a health career 4th Quarter.pptxPlanning a health career 4th Quarter.pptx
Planning a health career 4th Quarter.pptx
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choom
 
Romantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxRomantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptx
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptx
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 

Introduction to Basics of Python

  • 1. www.elewayte.com GET READY TO SSSSSSINK INTO PYTHON BASICS, ITS POWER & VERSATILITY
  • 2. iNTRODUCTION TO PYTHON Python is a high-level programming language that is widely used in various fields, including data science, web development, and artificial intelligence. Some of the key elements of Python include: 01 DATA TYPES 02 VARIABLES 03 OPERATORS 04 CONDITIONAL STATEMENTS 05 LOOPS 06 FUNCTIONS 07 LIBRARIES
  • 3. Data Types: So Many Flavors, So Little Time! In Python, data types are categories of values that determine how the values behave and what operations can be performed on them. Here are some common data types and their examples: TYPES DESCRIPTION EXAMPLES Numeric Represents numerical values 'int' , 'float' , 'complex' Sequence Represents a collection of ordered and indexed values 'list' , 'tuple' , 'range' Text Represents a sequence of characters 'str' Mapping Represents a collection of key-value pairs 'dict' Set Represents a collection of unique elements 'set' , 'frozenset' Boolean Represents a binary truth value 'bool' Binary Represents binary data 'bytes' , 'bytearray' , 'memoryview'
  • 4. Examples that shows how different data types can be used in Python:
  • 5. Variables: Party Time! Get Your Data On! A variable in Python is just a name that represents a value, and you can use it to store and manipulate data throughout your program. Let’s understand the same with a small example: In Python, we’ll try to create a variable called "age" and assign a value to it, like this: Now, whenever you need to use that age value in your program, you can just use the variable name "age". For example: The output will be: In this example, the variable "age" is assigned the value 15. Then, the print statement uses the value of the variable "age" to output the string "I am 15 years old." Note: We use the str() function to convert the integer value of "age" into a string, so we can concatenate it with the other strings in the output statement.
  • 6. Operators: Go crazy with Calculations! In Python, operators are symbols or special characters that allow you to perform different kinds of operations on variables and values. Here's a table that summarizes the different types of operators in Python, along with their descriptions and examples: TYPES DESCRIPTION EXAMPLES Arithmetic Operators Used to perform arithmetic operations '2 + 3' returns '5' Comparison Operators Used to compare values '2 < 3' returns 'True' Logical Operators Used to combine and manipulate boolean values 'True and False' returns 'False' Bitwise Operators Used to perform bitwise operations '5 & 3' returns '1' Assignment Operators Used to assign values to variables 'x=5' Identity Operators Used to compare the memory location of two objects 'x is y' returns 'True' Membership Operators Used to check if a value is present in a sequence '2 in [1, 2, 3]' return 'True'
  • 7.
  • 8. Conditional Statements: Be the boss of your code! Conditional statements in allow you to control the flow of your program based on certain conditions. They are used to make decisions in your code, and they help your program to be more flexible and responsive to different inputs. Here's a detailed description along with examples that demonstrates the different types of conditional statements in Python to perform various kinds of checks, such as checking if a number is greater than a certain value, or if it falls within a certain range. When you run this code, you will see the output for each conditional statement. TYPES DESCRIPTION EXAMPLES If statement Executes a block of code if a condition is true 'x=5' <br> 'if x>3:'<br> 'print("x is greater than 3")' If else statement Executes one block of code if a condition is true and another block if it is false 'x=2' <br> 'if x>3: '<br> 'print("x is greater than 3")' <br> 'else:' <br> 'print("x is less than or equal to 3")' elif statement Executes a block of code if a condition is true, and if not, checks another condition 'x = 5' <br> 'if x > 7: ' <br> 'print("x is greater than 7")' <br> 'elif x > 3: '<br> 'print("x is greater than 3 but less than or equal to 7")' <br> 'else:' <br> 'print("x is less than or equal to 3")' nested if statement Executes a block of code if a condition is true, and that block can contain another if statement 'x = 5' <br> 'if x > 3:' <br> 'if x < 7:' <br> 'print("x is between 3 and7")' <br> 'else:' <br> 'print("x is greater than or equal to 7")' <br> 'else:'<br> 'print("x is less than or equal to 3")'
  • 9. Loops: Repeat After Me! Loops are used to repeat a block of code multiple times until a certain condition is met. There are two main types of loops in Python: for loops and while loops. Here's an example of a for loop that iterates over a list of numbers and prints each number along with the output. In this example, the loop will continue to run as long as count is greater than 0. Each time the loop runs, it prints the value of count, then subtracts 1 from it. Eventually, count becomes 0, and the loop stops running. There are also other types of loops in Python, such as nested loops, which allow you to put one loop inside another, and break and continue statements, which allow you to control the flow of the loop. INPUT OUTPUT FOR LOOP LOOP TYPE DESCRIPTION 'for' loop Used to iterate over a sequence of elements, such as a list or string 'while' loop Used to repeat a block of code while a certain condition is true WHILE LOOP
  • 10. FUNCTION TYPE DESCRIPTION Built-in functions Functions that are built in python and can be used without needing to define them. Examples - 'print()' , 'len()' and 'range()' User-defined functions Functions that you create yourself to perform a specific task. They can be reused multiple times throughout your code. Functions: The Superheroes of Code! Functions are reusable blocks of code that perform a specific task. They allow you to write a piece of code once and use it multiple times without having to rewrite the code. There are two main types of functions in Python: built-in functions and user- defined functions. In this example, we define a function called add_numbers() that takes two parameters, a and b. The function adds a and b together and returns the sum. We then call the function with the values 2 and 3, which returns 5. Finally, we print the result. INPUT OUTPUT Built-in function User- defined function
  • 11. Functions Continue... Here's an example of using the math library to calculate the square root of a number: Another example is using the pandas library to read a CSV file and display its contents:
  • 12. Python's Top Guns: The Most Important Libraries 1. NumPy NumPy is a library for numerical computing in Python. It provides fast and efficient array operations and linear algebra routines. 2. Pandas Pandas is a library for data manipulation and analysis in Python. It provides powerful tools for working with structured data, such as dataframes and series. Example for importing NumPy Library in Python Example for importing Pandas Library in Python
  • 13. Libraries Continue... Matplotlib is a library for data visualization in Python. It provides a variety of plots and charts for visualizing data, including line plots, scatter plots, and histograms. Scikit-learn is a library for machine learning in Python. It provides tools for data preprocessing, model selection, and evaluation, as well as a range of machine learning algorithms. Example for importing Matplotlib Library in Python Example for importing Scikit- learn library in Python 3. Matplotlib 4. Scikit-learn
  • 14. FOLLOW FOR MORE SUCH CONTENTS www.elewayte.com elewayte_edu Elewayte Elewayte elewayte_