Python Certification Training https://www.edureka.co/python
Agenda
Python Certification Training https://www.edureka.co/python
Agenda
Introduction 01
Introduction
to Python
Getting Started 02
Concepts 03
Practical Approach 04
Installing and working
with Python
Looking at code to
understand theory
Overview of the
concepts in Python
Python Certification Training https://www.edureka.co/python
Introduction to Python
Python Certification Training https://www.edureka.co/python
Introduction to Python
Open Source
Python is a powerful high-level, object-oriented programming
language created by Guido van Rossum.
What is Python?
Largest community for
Learners and Collaborators
Let’s get started then!
I created
Python!
No. It wasn't named after a
dangerous snake.
Rossum was fan of a comedy
series from late seventies.
The name "Python" was
adopted from the same
series "Monty Python's
Flying Circus".
Python Certification Training https://www.edureka.co/python
Why is Python so popular?
Python Certification Training https://www.edureka.co/python
Popularity Of Python
Learning other
languages
Learning
Python
Python is very
beginner-friendly!
Hello Python!
Syntax is extremely
simple to read and
follow!
Millions of happy learners!
I’m a happy coder!
Python Certification Training https://www.edureka.co/python
Unique Features of Python
Python Certification Training https://www.edureka.co/python
Features Of Python
0102
03 04
0506
07
Simple language - Easier to learnFree and Open-Source
Portability Extensible and Embeddable
Large Standard Libraries High Level – Interpreted Language
Object Oriented You shall master Python!
Python Certification Training https://www.edureka.co/python
Why should you learn Python?
Python Certification Training https://www.edureka.co/python
Why Should You Learn Python?
Length of the code is relatively short
Python is a general-purpose language
Wide range of applications
Fun to work with!
Web Development Mathematical Computations Graphical User Interface
Python Certification Training https://www.edureka.co/python
4 Reasons to Choose Python
Python Certification Training https://www.edureka.co/python
Reasons to Choose Python as First Language
We can fetch any number of reasons for you!
a = 2
b = 3
sum = a + b
print(sum)
Why? The syntax feels natural.
Simple Elegant Syntax
Programming in Python is fun!
It's easier to understand and write Python code
Python Certification Training https://www.edureka.co/python
Reasons to Choose Python as First Language
We can fetch any number of reasons for you!
No need to define the type of a variable in Python
Also, no semicolon at the end of the statement
Not overly strict
Phew, no more
semicolon!!!
Python enforces you to follow good practices (like proper
indentation)
Python Certification Training https://www.edureka.co/python
Reasons to Choose Python as First Language
We can fetch any number of reasons for you!
Python allows you to write programs having greater
functionality with fewer lines of code
Expressiveness of the language
Woah
Python <3
You will be amazed how much you can do with Python
once you learn the basics
Python Certification Training https://www.edureka.co/python
Python has a large supporting community
Reasons to Choose Python as First Language
We can fetch any number of reasons for you!
Great Community and Support
We have an amazing community with lots of videos, blogs
and course certifications on Python!
Python Certification Training https://www.edureka.co/python
Installing And Running Python
Python Certification Training https://www.edureka.co/python
Installing And Running Python
6 very simple steps to install Python!
Go to the official Python download page on the official site and click Download Python 3.6.0
When the download is completed, double-click the file and follow the instructions to install it.
When Python is installed, a program called IDLE is also installed along with it. It provides
graphical user interface to work with Python.
To create a file in IDLE, go to File > New Window (Shortcut: Ctrl+N)
Write Python code and save (Shortcut: Ctrl+S) with .py file extension
Go to Run > Run module (Shortcut: F5) and you can see the output.
Python Certification Training https://www.edureka.co/python
Development Environments
Python Certification Training https://www.edureka.co/python
Development Environments
There are a lot of environments you can use!
Komodo IDE
Python Certification Training https://www.edureka.co/python
Compiling v/s Interpreting
Python Certification Training https://www.edureka.co/python
Compiling v/s Interpreting
Python is directly interpreted into machine instructions!
compile execute
outputsource code
Hello.java
byte code
Hello.class
interpret
outputsource code
Hello.py
I’m learning Python!
Python Certification Training https://www.edureka.co/python
Basics of Python
Python Certification Training https://www.edureka.co/python
Expressions
Diving into the heart of Python!
I’m learning Python!
Expression: A data value or set of operations to compute a value.
Examples: 1 + 4 * 3
42
Arithmetic operators we will use:
• + - * / addition, subtraction/negation, multiplication, division
• % modulus, a.k.a. remainder
• ** exponentiation
Precedence: Order in which operations are computed.
• * / % ** have a higher precedence than + -
1 + 3 * 4 is 13
• Parentheses can be used to force a certain order of evaluation.
(1 + 3) * 4 is 16
Python Certification Training https://www.edureka.co/python
Math Commands
Python has useful commands for performing calculations!
I’m learning Python!
Command name Description
abs(value) absolute value
ceil(value) rounds up
cos(value) cosine, in radians
floor(value) rounds down
log(value) logarithm, base e
log10(value) logarithm, base 10
max(value1, value2) larger of two values
min(value1, value2) smaller of two values
round(value) nearest whole number
sin(value) sine, in radians
sqrt(value) square root
Constant Description
e 2.7182818...
pi 3.1415926...
Python Certification Training https://www.edureka.co/python
Variables
Variable is a named piece of memory that can store a value!
I’m learning Python!
• Usage:
– Compute an expression's result,
– store that result into a variable,
– and use that variable later in the program.
Assignment statement: Stores a value into a variable.
• Syntax:
name = value
• Examples: x = 5
gpa = 3.14
• A variable that has been given a value can be used in
expressions.
x + 4 is 9
Python Certification Training https://www.edureka.co/python
Basic Datatypes
Many datatypes to choose from in Python!
I’m learning Python!
Integers (default for numbers)
z = 5 / 2 # Answer 2, integer division
Floats
x = 3.456
Strings
Can use “” or ‘’ to specify with “abc” == ‘abc’
Unmatched can occur within the string: “matt’s”
Use triple double-quotes for multi-line strings or strings than contain
both ‘ and “ inside of them:
“““a‘b“c”””
Python Certification Training https://www.edureka.co/python
Whitespaces
Whitespace is meaningful in Python: Especially indentation and placement of newlines
I’m learning Python!
Use a newline to end a line of code
Use  when must go to next line prematurely
No braces {} to mark blocks of code, use consistent indentation instead
•First line with less indentation is outside of the block
•First line with more indentation starts a nested block
Colons start of a new block in many constructs, e.g. function definitions, then
clauses.
Python Certification Training https://www.edureka.co/python
Comments
Comments help us understand the code better!
I’m learning Python!
Start comments with #, rest of line is ignored
Can include a “documentation string” as the first line of a new function or class you define
Development environments, debugger, and other tools use it: it’s good style to include one.
#ImAComment
Python Certification Training https://www.edureka.co/python
Assignment
So how do you put some value in a variable?
I’m learning Python!
Binding a variable in Python means setting a name to hold a reference to some object
Assignment creates references, not copies!
Names in Python do not have an intrinsic type, objects have types
Python determines the type of the reference automatically based on what data
is assigned to it
You create a name the first time it appears on the left side of an assignment
expression:
x = 3
A reference is deleted via garbage collection after any names bound to it have passed
out of scope.
Python uses reference semantics (more later)
Python Certification Training https://www.edureka.co/python
A Quick Break!
Python and it’s big players around the world!
Python Certification Training https://www.edureka.co/python
Naming Rules
Watch out for reserved words!
I’m learning Python!
Names are case sensitive and cannot start with a number. They can contain
letters, numbers, and underscores.
bob Bob _bob _2_bob_ bob_2 BoB
There are some reserved words:
and, assert, break, class, continue, def, del, elif, else, except, exec,
finally, for, from, global, if, import, in, is, lambda, not, or, pass, print,
raise, return, try, while
Python Certification Training https://www.edureka.co/python
Naming Conventions
We have 3 recommended conventions
I’m learning Python!
The Python community has these recommended naming conventions
• joined_lower for functions, methods and, attributes!
• joined_lower or ALL_CAPS for constants!
• StudlyCaps for classes!
Attributes: interface, _internal, __private
Python Certification Training https://www.edureka.co/python
Assignment – An Easier Way?
Less of typing means more of coding!
I’m learning Python!
You can assign to multiple names at the same time
>>> x, y = 2, 3
>>> x
2
>>> y
3
This makes it easy to swap values
>>> x, y = y, x
Assignments can be chained
>>> a = b = x = 2
Python Certification Training https://www.edureka.co/python
Accessing Non-Existent Names
Let’s see how we can raise an error!
I’m learning Python!
Accessing a name before it’s been properly created (by placing
it on the left side of an assignment), raises an error
>>> y
Traceback (most recent call last):
File "<pyshell#16>", line 1, in -toplevel-
y
NameError: name ‘y' is not defined
>>> y = 3
>>> y
3
Python Certification Training https://www.edureka.co/python
Casting
We can explicitly convert based on requirement
I’m learning Python!
Casting in python is therefore done using constructor functions:
•int() - constructs an integer number from an integer literal, a float literal (by
rounding down to the previous whole number), or a string literal (providing the string
represents a whole number)
•float() - constructs a float number from an integer literal, a float literal or a string
literal (providing the string represents a float or an integer)
•str() - constructs a string from a wide variety of data types, including strings, integer
literals and float literals
Python Certification Training https://www.edureka.co/python
Casting
We can explicitly convert based on requirement
I’m learning Python!
x = int(1) # x will be 1
y = int(2.8) # y will be 2
z = int("3") # z will be 3
x = float(1) # x will be 1.0
y = float(2.8) # y will be 2.8
z = float("3") # z will be 3.0
w = float("4.2") # w will be 4.2
x = str("s1") # x will be 's1'
y = str(2) # y will be '2'
z = str(3.0) # z will be '3.0'
Told you
Python is
real easy!
Python Certification Training https://www.edureka.co/python
Let’s Code
Python Certification Training https://www.edureka.co/python
Python Operators
Python Certification Training https://www.edureka.co/python
Arithmetic Operators
We can perform common math operations easily!
I’m learning Python!
Operator Name Example
+ Addition x + y
- Subtraction x – y
* Multiplication x * y
/ Division x / y
* Modulus x % y
** Exponentiation x ** y
// Floor Division x // y
Python Certification Training https://www.edureka.co/python
Assignment Operators
We can assign values to variables easily!
I’m learning Python!
Operator Example Same As
= x = 5 x = 5
+= x += 3 x = x + 3
-= x -= 3 x = x – 3
*= x *= 3 x= x * 3
&= x &= 3 x = x & 3
>>= x >>= 3 x = x >> 3
<<= x <<= 3 x = x <<3
Python Certification Training https://www.edureka.co/python
Comparison Operators
We can compare two values easily!
I’m learning Python!
Operator Name Example
== Equal x == y
!= Not Equal x != y
> Greater Than x > y
< Less Than x < y
>= Greater than or equal to x >= y
<= Less than or equal to x <= y
Python Certification Training https://www.edureka.co/python
Logical Operators
Can we combine conditional statements?
Yes, we can!
I’m learning Python!
Operator Description Example
And
Returns True if both
statements are true
x < 5 and x < 10
Or
Returns True if one of
the statements is true
x < 5 or x < 4
Not
Reverse the result,
returns False if the result
is True
not(x , 5 and x < 10)
Python Certification Training https://www.edureka.co/python
Identity Operators
Compare objects, not to check if they are equal
but to check if they are the same object
I’m learning Python!
Operator Description Example
is
Returns True if both variables
are same object
x is y
is not
Returns True if both variables
are not same object
x is not y
Python Certification Training https://www.edureka.co/python
Bitwise Operators
Let’s compare binary numbers and operate on them!
I’m learning Python!
Operator Name Description
& AND Sets each bit to 1 if both bits are 1
| OR Sets each bit to 1 if one of two bits are 1
^ XOR Sets each bit to 1 if only one of two bits in 1
~ NOT Inverts all the bits
<< Zero fill left shift
Shift left by pushing zeros in from the right and let the
leftmost bits fall off
>> Signed right shift
Shift right by pushing copies of leftmost bit in from the left
and let the rightmost bits fall off
Python Certification Training https://www.edureka.co/python
Python Lists – Back to Code!
Python Certification Training https://www.edureka.co/python
List Methods
Python has a set of built-in methods that you can use!
I’m learning Python!
Method Description
append() Adds an element at the end of the list
clear() Removes all the elements from the list
copy() Returns a copy of the list
count() Returns the number of elements with the specified value
extend() Add the elements of a list to the end of the current list
index() Returns the index of the first element with the specified value
insert() Adds an element at the specified position
pop() Removes the element at the specified position
remove() Removes the item with the specified value
reverse() Reverses the order of the list
sort() Sorts the list
Python Certification Training https://www.edureka.co/python
Python Tuples – Back to Code!
Python Certification Training https://www.edureka.co/python
Tuple Methods
Python has two built-in methods you can use on tuples!
I’m learning Python!
Method Description
count()
Returns the number of times a specified value occurs
in a tuple
index()
Searches the tuple for a specified value and returns
the position of where it was found
Python Certification Training https://www.edureka.co/python
Python Sets – Back to Code!
Python Certification Training https://www.edureka.co/python
Set Methods
Python has two built-in methods you can use on tuples!
I’m learning Python!
Method Description
add() Adds an element to the set
clear() Removes all the elements from the set
copy() Returns a copy of the set
difference()
Returns a set containing the difference between two
or more sets
difference_update()
Removes the items in this set that are also included
in another specified set
discard() Remove the specified item
intersection() Returns the intersection of two other set
issubset() Returns whether another set contains this set or not
pop() Removes an element from the set
Python Certification Training https://www.edureka.co/python
Python Dictionaries – Back to Code!
Python Certification Training https://www.edureka.co/python
Dictionary Methods
Python has a set of built-in methods you can use on dictionaries
I’m learning Python!
Method Description
clear() Removes all the elements from the dictionary
copy() Returns a copy of the dictionary
fromkeys() Returns a dictionary with specified keys and values
get() Returns the value of the specified key
items() Returns a list containing the tuple for each key value pair
keys() Returns a list containing the dictionary's keys
update() Updates the dictionary with specified key-valu pairs
pop() Removes an element from the dictionary
Python Certification Training https://www.edureka.co/python
Condition Statements – More Code!
Python Certification Training https://www.edureka.co/python
Looping In Python – Easy Code!
Python Certification Training https://www.edureka.co/python
Python Functions – Easier Than You Think!
Python Certification Training https://www.edureka.co/python
Arrays – Simple And Straightforward!
Python Certification Training https://www.edureka.co/python
Array Methods
Python has a set of built-in methods you can use on lists/arrays!
I’m learning Python!
Method Description
clear() Removes all the elements from the array
copy() Returns a copy of the array
count() Returns the number of elements with the specified value
insert() Adds an element at the specified position
pop() Removes an element at the specified position
remove() Removes the first item with the specified value
reverse() Reverses the order of the array
sort() Sorts the array
Python Certification Training https://www.edureka.co/python
Classes & Objects – OOP (Code Again!)
Python Certification Training https://www.edureka.co/python
Modules – Last Concept For The Session!
Python Certification Training https://www.edureka.co/python
Conclusion
Python Certification Training https://www.edureka.co/python
Conclusion
Python Tutorial For Beginners | Python Crash Course - Python Programming Language Tutorial | Edureka

More Related Content

PDF
Python Projects For Beginners | Python Projects Examples | Python Tutorial | ...
PDF
Introduction To Python | Edureka
PDF
Begin with Python
PPTX
Python
PPT
Introduction to python
PPTX
Python 101: Python for Absolute Beginners (PyTexas 2014)
PDF
Python Basics | Python Tutorial | Edureka
Python Projects For Beginners | Python Projects Examples | Python Tutorial | ...
Introduction To Python | Edureka
Begin with Python
Python
Introduction to python
Python 101: Python for Absolute Beginners (PyTexas 2014)
Python Basics | Python Tutorial | Edureka

What's hot (20)

PDF
Python Course | Python Programming | Python Tutorial | Python Training | Edureka
PDF
Python Programming Tutorial | Edureka
PPTX
Basics of python
PDF
Python Programming Language | Python Classes | Python Tutorial | Python Train...
PDF
Python Tutorial | Python Tutorial for Beginners | Python Training | Edureka
PPT
Python ppt
PPT
Introduction to Python
PPTX
Introduction to python
PPTX
Python PPT
PPTX
Python
PDF
Introduction to python
PPTX
Introduction to-python
PPTX
Python | What is Python | History of Python | Python Tutorial
PDF
Python libraries
PPTX
Introduction to python
PDF
Python Crash Course
PDF
Python basic
PDF
Variables & Data Types In Python | Edureka
PDF
Overview of python 2019
PPTX
Python and its Applications
Python Course | Python Programming | Python Tutorial | Python Training | Edureka
Python Programming Tutorial | Edureka
Basics of python
Python Programming Language | Python Classes | Python Tutorial | Python Train...
Python Tutorial | Python Tutorial for Beginners | Python Training | Edureka
Python ppt
Introduction to Python
Introduction to python
Python PPT
Python
Introduction to python
Introduction to-python
Python | What is Python | History of Python | Python Tutorial
Python libraries
Introduction to python
Python Crash Course
Python basic
Variables & Data Types In Python | Edureka
Overview of python 2019
Python and its Applications
Ad

Similar to Python Tutorial For Beginners | Python Crash Course - Python Programming Language Tutorial | Edureka (20)

DOCX
A Introduction Book of python For Beginners.docx
PDF
Python basic programing language for automation
PPTX
Introduction-to-Python-Programming1.pptx
PDF
Sessisgytcfgggggggggggggggggggggggggggggggg
PPT
Introduction to Python For Diploma Students
PPTX
Module-1.pptx
PPTX
python notes for MASTER OF COMPUTER APPLIICATION_ppt.pptx
PPTX
Python-Certification-Training-Day-1-2.pptx
PPTX
Introduction about Python by JanBask Training
PPTX
VKS-Python Basics for Beginners and advance.pptx
PPTX
Exploring Data Science Using Python Tools
PPTX
Introduction to Python Programming .pptx
PPTX
#Code2Create: Python Basics
PPTX
Python_Introduction&DataType.pptx
PPTX
Introduction to learn and Python Interpreter
PPTX
lecture 2.pptx
PPTX
Python Conditional and Looping statements.pptx
PDF
Raspberry using Python Session 1
PPTX
Welcome to python workshop
PDF
Py-Slides- easuajsjsjejejjwlqpqpqpp1.pdf
A Introduction Book of python For Beginners.docx
Python basic programing language for automation
Introduction-to-Python-Programming1.pptx
Sessisgytcfgggggggggggggggggggggggggggggggg
Introduction to Python For Diploma Students
Module-1.pptx
python notes for MASTER OF COMPUTER APPLIICATION_ppt.pptx
Python-Certification-Training-Day-1-2.pptx
Introduction about Python by JanBask Training
VKS-Python Basics for Beginners and advance.pptx
Exploring Data Science Using Python Tools
Introduction to Python Programming .pptx
#Code2Create: Python Basics
Python_Introduction&DataType.pptx
Introduction to learn and Python Interpreter
lecture 2.pptx
Python Conditional and Looping statements.pptx
Raspberry using Python Session 1
Welcome to python workshop
Py-Slides- easuajsjsjejejjwlqpqpqpp1.pdf
Ad

More from Edureka! (20)

PDF
What to learn during the 21 days Lockdown | Edureka
PDF
Top 10 Dying Programming Languages in 2020 | Edureka
PDF
Top 5 Trending Business Intelligence Tools | Edureka
PDF
Tableau Tutorial for Data Science | Edureka
PDF
Top 5 PMP Certifications | Edureka
PDF
Top Maven Interview Questions in 2020 | Edureka
PDF
Linux Mint Tutorial | Edureka
PDF
How to Deploy Java Web App in AWS| Edureka
PDF
Importance of Digital Marketing | Edureka
PDF
RPA in 2020 | Edureka
PDF
Email Notifications in Jenkins | Edureka
PDF
EA Algorithm in Machine Learning | Edureka
PDF
Cognitive AI Tutorial | Edureka
PDF
AWS Cloud Practitioner Tutorial | Edureka
PDF
Blue Prism Top Interview Questions | Edureka
PDF
Big Data on AWS Tutorial | Edureka
PDF
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
PDF
Kubernetes Installation on Ubuntu | Edureka
PDF
Introduction to DevOps | Edureka
PDF
ITIL® Tutorial for Beginners | ITIL® Foundation Training | Edureka
What to learn during the 21 days Lockdown | Edureka
Top 10 Dying Programming Languages in 2020 | Edureka
Top 5 Trending Business Intelligence Tools | Edureka
Tableau Tutorial for Data Science | Edureka
Top 5 PMP Certifications | Edureka
Top Maven Interview Questions in 2020 | Edureka
Linux Mint Tutorial | Edureka
How to Deploy Java Web App in AWS| Edureka
Importance of Digital Marketing | Edureka
RPA in 2020 | Edureka
Email Notifications in Jenkins | Edureka
EA Algorithm in Machine Learning | Edureka
Cognitive AI Tutorial | Edureka
AWS Cloud Practitioner Tutorial | Edureka
Blue Prism Top Interview Questions | Edureka
Big Data on AWS Tutorial | Edureka
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
Kubernetes Installation on Ubuntu | Edureka
Introduction to DevOps | Edureka
ITIL® Tutorial for Beginners | ITIL® Foundation Training | Edureka

Recently uploaded (20)

PDF
sustainability-14-14877-v2.pddhzftheheeeee
PPTX
Benefits of Physical activity for teenagers.pptx
PDF
DP Operators-handbook-extract for the Mautical Institute
PDF
August Patch Tuesday
PPTX
Web Crawler for Trend Tracking Gen Z Insights.pptx
PPTX
Chapter 5: Probability Theory and Statistics
PDF
Getting Started with Data Integration: FME Form 101
PDF
Hindi spoken digit analysis for native and non-native speakers
PDF
Developing a website for English-speaking practice to English as a foreign la...
PDF
WOOl fibre morphology and structure.pdf for textiles
PPT
Geologic Time for studying geology for geologist
PPTX
Group 1 Presentation -Planning and Decision Making .pptx
PDF
A review of recent deep learning applications in wood surface defect identifi...
PDF
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
PDF
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
PDF
Zenith AI: Advanced Artificial Intelligence
PPTX
Tartificialntelligence_presentation.pptx
PDF
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
PPTX
The various Industrial Revolutions .pptx
PDF
Assigned Numbers - 2025 - Bluetooth® Document
sustainability-14-14877-v2.pddhzftheheeeee
Benefits of Physical activity for teenagers.pptx
DP Operators-handbook-extract for the Mautical Institute
August Patch Tuesday
Web Crawler for Trend Tracking Gen Z Insights.pptx
Chapter 5: Probability Theory and Statistics
Getting Started with Data Integration: FME Form 101
Hindi spoken digit analysis for native and non-native speakers
Developing a website for English-speaking practice to English as a foreign la...
WOOl fibre morphology and structure.pdf for textiles
Geologic Time for studying geology for geologist
Group 1 Presentation -Planning and Decision Making .pptx
A review of recent deep learning applications in wood surface defect identifi...
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
Zenith AI: Advanced Artificial Intelligence
Tartificialntelligence_presentation.pptx
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
The various Industrial Revolutions .pptx
Assigned Numbers - 2025 - Bluetooth® Document

Python Tutorial For Beginners | Python Crash Course - Python Programming Language Tutorial | Edureka

  • 1. Python Certification Training https://www.edureka.co/python Agenda
  • 2. Python Certification Training https://www.edureka.co/python Agenda Introduction 01 Introduction to Python Getting Started 02 Concepts 03 Practical Approach 04 Installing and working with Python Looking at code to understand theory Overview of the concepts in Python
  • 3. Python Certification Training https://www.edureka.co/python Introduction to Python
  • 4. Python Certification Training https://www.edureka.co/python Introduction to Python Open Source Python is a powerful high-level, object-oriented programming language created by Guido van Rossum. What is Python? Largest community for Learners and Collaborators Let’s get started then! I created Python! No. It wasn't named after a dangerous snake. Rossum was fan of a comedy series from late seventies. The name "Python" was adopted from the same series "Monty Python's Flying Circus".
  • 5. Python Certification Training https://www.edureka.co/python Why is Python so popular?
  • 6. Python Certification Training https://www.edureka.co/python Popularity Of Python Learning other languages Learning Python Python is very beginner-friendly! Hello Python! Syntax is extremely simple to read and follow! Millions of happy learners! I’m a happy coder!
  • 7. Python Certification Training https://www.edureka.co/python Unique Features of Python
  • 8. Python Certification Training https://www.edureka.co/python Features Of Python 0102 03 04 0506 07 Simple language - Easier to learnFree and Open-Source Portability Extensible and Embeddable Large Standard Libraries High Level – Interpreted Language Object Oriented You shall master Python!
  • 9. Python Certification Training https://www.edureka.co/python Why should you learn Python?
  • 10. Python Certification Training https://www.edureka.co/python Why Should You Learn Python? Length of the code is relatively short Python is a general-purpose language Wide range of applications Fun to work with! Web Development Mathematical Computations Graphical User Interface
  • 11. Python Certification Training https://www.edureka.co/python 4 Reasons to Choose Python
  • 12. Python Certification Training https://www.edureka.co/python Reasons to Choose Python as First Language We can fetch any number of reasons for you! a = 2 b = 3 sum = a + b print(sum) Why? The syntax feels natural. Simple Elegant Syntax Programming in Python is fun! It's easier to understand and write Python code
  • 13. Python Certification Training https://www.edureka.co/python Reasons to Choose Python as First Language We can fetch any number of reasons for you! No need to define the type of a variable in Python Also, no semicolon at the end of the statement Not overly strict Phew, no more semicolon!!! Python enforces you to follow good practices (like proper indentation)
  • 14. Python Certification Training https://www.edureka.co/python Reasons to Choose Python as First Language We can fetch any number of reasons for you! Python allows you to write programs having greater functionality with fewer lines of code Expressiveness of the language Woah Python <3 You will be amazed how much you can do with Python once you learn the basics
  • 15. Python Certification Training https://www.edureka.co/python Python has a large supporting community Reasons to Choose Python as First Language We can fetch any number of reasons for you! Great Community and Support We have an amazing community with lots of videos, blogs and course certifications on Python!
  • 16. Python Certification Training https://www.edureka.co/python Installing And Running Python
  • 17. Python Certification Training https://www.edureka.co/python Installing And Running Python 6 very simple steps to install Python! Go to the official Python download page on the official site and click Download Python 3.6.0 When the download is completed, double-click the file and follow the instructions to install it. When Python is installed, a program called IDLE is also installed along with it. It provides graphical user interface to work with Python. To create a file in IDLE, go to File > New Window (Shortcut: Ctrl+N) Write Python code and save (Shortcut: Ctrl+S) with .py file extension Go to Run > Run module (Shortcut: F5) and you can see the output.
  • 18. Python Certification Training https://www.edureka.co/python Development Environments
  • 19. Python Certification Training https://www.edureka.co/python Development Environments There are a lot of environments you can use! Komodo IDE
  • 20. Python Certification Training https://www.edureka.co/python Compiling v/s Interpreting
  • 21. Python Certification Training https://www.edureka.co/python Compiling v/s Interpreting Python is directly interpreted into machine instructions! compile execute outputsource code Hello.java byte code Hello.class interpret outputsource code Hello.py I’m learning Python!
  • 22. Python Certification Training https://www.edureka.co/python Basics of Python
  • 23. Python Certification Training https://www.edureka.co/python Expressions Diving into the heart of Python! I’m learning Python! Expression: A data value or set of operations to compute a value. Examples: 1 + 4 * 3 42 Arithmetic operators we will use: • + - * / addition, subtraction/negation, multiplication, division • % modulus, a.k.a. remainder • ** exponentiation Precedence: Order in which operations are computed. • * / % ** have a higher precedence than + - 1 + 3 * 4 is 13 • Parentheses can be used to force a certain order of evaluation. (1 + 3) * 4 is 16
  • 24. Python Certification Training https://www.edureka.co/python Math Commands Python has useful commands for performing calculations! I’m learning Python! Command name Description abs(value) absolute value ceil(value) rounds up cos(value) cosine, in radians floor(value) rounds down log(value) logarithm, base e log10(value) logarithm, base 10 max(value1, value2) larger of two values min(value1, value2) smaller of two values round(value) nearest whole number sin(value) sine, in radians sqrt(value) square root Constant Description e 2.7182818... pi 3.1415926...
  • 25. Python Certification Training https://www.edureka.co/python Variables Variable is a named piece of memory that can store a value! I’m learning Python! • Usage: – Compute an expression's result, – store that result into a variable, – and use that variable later in the program. Assignment statement: Stores a value into a variable. • Syntax: name = value • Examples: x = 5 gpa = 3.14 • A variable that has been given a value can be used in expressions. x + 4 is 9
  • 26. Python Certification Training https://www.edureka.co/python Basic Datatypes Many datatypes to choose from in Python! I’m learning Python! Integers (default for numbers) z = 5 / 2 # Answer 2, integer division Floats x = 3.456 Strings Can use “” or ‘’ to specify with “abc” == ‘abc’ Unmatched can occur within the string: “matt’s” Use triple double-quotes for multi-line strings or strings than contain both ‘ and “ inside of them: “““a‘b“c”””
  • 27. Python Certification Training https://www.edureka.co/python Whitespaces Whitespace is meaningful in Python: Especially indentation and placement of newlines I’m learning Python! Use a newline to end a line of code Use when must go to next line prematurely No braces {} to mark blocks of code, use consistent indentation instead •First line with less indentation is outside of the block •First line with more indentation starts a nested block Colons start of a new block in many constructs, e.g. function definitions, then clauses.
  • 28. Python Certification Training https://www.edureka.co/python Comments Comments help us understand the code better! I’m learning Python! Start comments with #, rest of line is ignored Can include a “documentation string” as the first line of a new function or class you define Development environments, debugger, and other tools use it: it’s good style to include one. #ImAComment
  • 29. Python Certification Training https://www.edureka.co/python Assignment So how do you put some value in a variable? I’m learning Python! Binding a variable in Python means setting a name to hold a reference to some object Assignment creates references, not copies! Names in Python do not have an intrinsic type, objects have types Python determines the type of the reference automatically based on what data is assigned to it You create a name the first time it appears on the left side of an assignment expression: x = 3 A reference is deleted via garbage collection after any names bound to it have passed out of scope. Python uses reference semantics (more later)
  • 30. Python Certification Training https://www.edureka.co/python A Quick Break! Python and it’s big players around the world!
  • 31. Python Certification Training https://www.edureka.co/python Naming Rules Watch out for reserved words! I’m learning Python! Names are case sensitive and cannot start with a number. They can contain letters, numbers, and underscores. bob Bob _bob _2_bob_ bob_2 BoB There are some reserved words: and, assert, break, class, continue, def, del, elif, else, except, exec, finally, for, from, global, if, import, in, is, lambda, not, or, pass, print, raise, return, try, while
  • 32. Python Certification Training https://www.edureka.co/python Naming Conventions We have 3 recommended conventions I’m learning Python! The Python community has these recommended naming conventions • joined_lower for functions, methods and, attributes! • joined_lower or ALL_CAPS for constants! • StudlyCaps for classes! Attributes: interface, _internal, __private
  • 33. Python Certification Training https://www.edureka.co/python Assignment – An Easier Way? Less of typing means more of coding! I’m learning Python! You can assign to multiple names at the same time >>> x, y = 2, 3 >>> x 2 >>> y 3 This makes it easy to swap values >>> x, y = y, x Assignments can be chained >>> a = b = x = 2
  • 34. Python Certification Training https://www.edureka.co/python Accessing Non-Existent Names Let’s see how we can raise an error! I’m learning Python! Accessing a name before it’s been properly created (by placing it on the left side of an assignment), raises an error >>> y Traceback (most recent call last): File "<pyshell#16>", line 1, in -toplevel- y NameError: name ‘y' is not defined >>> y = 3 >>> y 3
  • 35. Python Certification Training https://www.edureka.co/python Casting We can explicitly convert based on requirement I’m learning Python! Casting in python is therefore done using constructor functions: •int() - constructs an integer number from an integer literal, a float literal (by rounding down to the previous whole number), or a string literal (providing the string represents a whole number) •float() - constructs a float number from an integer literal, a float literal or a string literal (providing the string represents a float or an integer) •str() - constructs a string from a wide variety of data types, including strings, integer literals and float literals
  • 36. Python Certification Training https://www.edureka.co/python Casting We can explicitly convert based on requirement I’m learning Python! x = int(1) # x will be 1 y = int(2.8) # y will be 2 z = int("3") # z will be 3 x = float(1) # x will be 1.0 y = float(2.8) # y will be 2.8 z = float("3") # z will be 3.0 w = float("4.2") # w will be 4.2 x = str("s1") # x will be 's1' y = str(2) # y will be '2' z = str(3.0) # z will be '3.0' Told you Python is real easy!
  • 37. Python Certification Training https://www.edureka.co/python Let’s Code
  • 38. Python Certification Training https://www.edureka.co/python Python Operators
  • 39. Python Certification Training https://www.edureka.co/python Arithmetic Operators We can perform common math operations easily! I’m learning Python! Operator Name Example + Addition x + y - Subtraction x – y * Multiplication x * y / Division x / y * Modulus x % y ** Exponentiation x ** y // Floor Division x // y
  • 40. Python Certification Training https://www.edureka.co/python Assignment Operators We can assign values to variables easily! I’m learning Python! Operator Example Same As = x = 5 x = 5 += x += 3 x = x + 3 -= x -= 3 x = x – 3 *= x *= 3 x= x * 3 &= x &= 3 x = x & 3 >>= x >>= 3 x = x >> 3 <<= x <<= 3 x = x <<3
  • 41. Python Certification Training https://www.edureka.co/python Comparison Operators We can compare two values easily! I’m learning Python! Operator Name Example == Equal x == y != Not Equal x != y > Greater Than x > y < Less Than x < y >= Greater than or equal to x >= y <= Less than or equal to x <= y
  • 42. Python Certification Training https://www.edureka.co/python Logical Operators Can we combine conditional statements? Yes, we can! I’m learning Python! Operator Description Example And Returns True if both statements are true x < 5 and x < 10 Or Returns True if one of the statements is true x < 5 or x < 4 Not Reverse the result, returns False if the result is True not(x , 5 and x < 10)
  • 43. Python Certification Training https://www.edureka.co/python Identity Operators Compare objects, not to check if they are equal but to check if they are the same object I’m learning Python! Operator Description Example is Returns True if both variables are same object x is y is not Returns True if both variables are not same object x is not y
  • 44. Python Certification Training https://www.edureka.co/python Bitwise Operators Let’s compare binary numbers and operate on them! I’m learning Python! Operator Name Description & AND Sets each bit to 1 if both bits are 1 | OR Sets each bit to 1 if one of two bits are 1 ^ XOR Sets each bit to 1 if only one of two bits in 1 ~ NOT Inverts all the bits << Zero fill left shift Shift left by pushing zeros in from the right and let the leftmost bits fall off >> Signed right shift Shift right by pushing copies of leftmost bit in from the left and let the rightmost bits fall off
  • 45. Python Certification Training https://www.edureka.co/python Python Lists – Back to Code!
  • 46. Python Certification Training https://www.edureka.co/python List Methods Python has a set of built-in methods that you can use! I’m learning Python! Method Description append() Adds an element at the end of the list clear() Removes all the elements from the list copy() Returns a copy of the list count() Returns the number of elements with the specified value extend() Add the elements of a list to the end of the current list index() Returns the index of the first element with the specified value insert() Adds an element at the specified position pop() Removes the element at the specified position remove() Removes the item with the specified value reverse() Reverses the order of the list sort() Sorts the list
  • 47. Python Certification Training https://www.edureka.co/python Python Tuples – Back to Code!
  • 48. Python Certification Training https://www.edureka.co/python Tuple Methods Python has two built-in methods you can use on tuples! I’m learning Python! Method Description count() Returns the number of times a specified value occurs in a tuple index() Searches the tuple for a specified value and returns the position of where it was found
  • 49. Python Certification Training https://www.edureka.co/python Python Sets – Back to Code!
  • 50. Python Certification Training https://www.edureka.co/python Set Methods Python has two built-in methods you can use on tuples! I’m learning Python! Method Description add() Adds an element to the set clear() Removes all the elements from the set copy() Returns a copy of the set difference() Returns a set containing the difference between two or more sets difference_update() Removes the items in this set that are also included in another specified set discard() Remove the specified item intersection() Returns the intersection of two other set issubset() Returns whether another set contains this set or not pop() Removes an element from the set
  • 51. Python Certification Training https://www.edureka.co/python Python Dictionaries – Back to Code!
  • 52. Python Certification Training https://www.edureka.co/python Dictionary Methods Python has a set of built-in methods you can use on dictionaries I’m learning Python! Method Description clear() Removes all the elements from the dictionary copy() Returns a copy of the dictionary fromkeys() Returns a dictionary with specified keys and values get() Returns the value of the specified key items() Returns a list containing the tuple for each key value pair keys() Returns a list containing the dictionary's keys update() Updates the dictionary with specified key-valu pairs pop() Removes an element from the dictionary
  • 53. Python Certification Training https://www.edureka.co/python Condition Statements – More Code!
  • 54. Python Certification Training https://www.edureka.co/python Looping In Python – Easy Code!
  • 55. Python Certification Training https://www.edureka.co/python Python Functions – Easier Than You Think!
  • 56. Python Certification Training https://www.edureka.co/python Arrays – Simple And Straightforward!
  • 57. Python Certification Training https://www.edureka.co/python Array Methods Python has a set of built-in methods you can use on lists/arrays! I’m learning Python! Method Description clear() Removes all the elements from the array copy() Returns a copy of the array count() Returns the number of elements with the specified value insert() Adds an element at the specified position pop() Removes an element at the specified position remove() Removes the first item with the specified value reverse() Reverses the order of the array sort() Sorts the array
  • 58. Python Certification Training https://www.edureka.co/python Classes & Objects – OOP (Code Again!)
  • 59. Python Certification Training https://www.edureka.co/python Modules – Last Concept For The Session!
  • 60. Python Certification Training https://www.edureka.co/python Conclusion
  • 61. Python Certification Training https://www.edureka.co/python Conclusion