www.edureka.co/pythonEDUREKA PYTHON CERTIFICATION TRAINING
Python Programming
www.edureka.co/pythonEDUREKA PYTHON CERTIFICATION TRAINING
➢ Install Python
➢ Install PyCharm - IDE for Python
➢ Python Programming
▪ Variables
▪ Data types
▪ Operators
▪ Conditional Statements
▪ Loops
▪ Functions
▪ Classes and Objects
➢ Summary
Agenda
www.edureka.co/pythonEDUREKA PYTHON CERTIFICATION TRAINING
Python Installation
www.edureka.co/pythonEDUREKA PYTHON CERTIFICATION TRAINING
Pycharm Installation
www.edureka.co/pythonEDUREKA PYTHON CERTIFICATION TRAINING
Variables
Data types
Operators
Conditional
Statements
Loops
Functions
Classes and
Objects
www.edureka.co/pythonEDUREKA PYTHON CERTIFICATION TRAINING
Python Variable
C=‘edureka’
A = 16
B = 20
C = ‘edureka’
B=20
A=16 Memory
Memory
Memory
Variable
Variables are nothing but reserved memory locations to store values. This means that when you
create a variable you reserve some space in memory.
www.edureka.co/pythonEDUREKA PYTHON CERTIFICATION TRAINING
Variables
Data types
Operators
Conditional
Statements
Loops
Functions
Classes and
Objects
www.edureka.co/pythonEDUREKA PYTHON CERTIFICATION TRAINING
Data types
Python Data types
A data type, in programming, is a classification that specifies which type of value a variable has and what
type of mathematical, relational or logical operations can be applied to it without causing an error.
C=‘edureka’
A = 16
B = 20
C = ‘edureka’
B=20
A=16 Integer
Datatype
Integer
Datatype
String
Datatype
www.edureka.co/pythonEDUREKA PYTHON CERTIFICATION TRAINING
Python Data types
Data types
Numeric
List
Tuple
Strings
Set
Dictionary
www.edureka.co/pythonEDUREKA PYTHON CERTIFICATION TRAINING
Tuples
Strings
Set
Dictionary
Numeric1
3
4
5
6
Lists32
Numeric Data type
 Number data types are used to store numeric values.
 There are four different numerical types in Python:
A = 16
B = 1.678
C = 2 + i6
D = 909065*35353537
Integer Type
Float Type
Complex Type
Long Type
www.edureka.co/pythonEDUREKA PYTHON CERTIFICATION TRAINING
Tuples
Strings
Set
Dictionary
Numeric1
3
4
5
6
Lists22
List Data type
The list is a most versatile datatype available in Python which can be written as a list of
comma-separated values (items) between square brackets
list1 = ['physics', 'chemistry', 1997, 2000]For example:
Accessing Values in Lists
Updating List
Delete List Elements
List Length
Concatenation
Repetition
www.edureka.co/pythonEDUREKA PYTHON CERTIFICATION TRAINING
Tuples Data type
Tuples
Strings
Set
Dictionary
Numeric1
3
4
5
6
Tuples23
Lists32
A tuple is a sequence of immutable Python objects. Tuples are sequences, just like lists.
Tup1 = ('physics', 'chemistry', 1997, 2000)For example:
Accessing Values in Tuple
Updating Tuple
Delete Tuple Elements
Tuple Length
Concatenation
Repetition
www.edureka.co/pythonEDUREKA PYTHON CERTIFICATION TRAINING
String Data type
Strings
Set
Dictionary
Numeric1
4
5
6
Lists32
Strings24
Tuples3
A string in Python is a sequence of characters. We can create Strings by enclosing
characters in quotes. Python treats single quotes the same as double quotes. Consider
the example below:
Operation Syntax
String Length print(len(string_name))
Locate a character in string print(strig_name.index(“Char"))
Count the number of times a character is
repeated in a string
print(string_name.count("Char"))
Print a part of the string print(string_name[start:stop])
Reverse a string print(string_name[::-1])
Convert the letters in a string to upper-case print(string_name.upper())
Convert the letters in a string to lower-case print(string_name.lower())
A = ‘Master Python At edureka’
B = ‘Welcome to edureka!’
www.edureka.co/pythonEDUREKA PYTHON CERTIFICATION TRAINING
Set Data type
Set
Dictionary
Numeric1
5
6
Lists32
Tuples3
Strings4 Set25
Strings4
Set is an unordered collection of unique items. Set is defined by
values separated by comma inside braces { }.
For Example:
www.edureka.co/pythonEDUREKA PYTHON CERTIFICATION TRAINING
Dictionary Data type
Dictionary
Numeric1
6
Lists32
Tuples3
Strings4
Set5 Strings4 Dictionary26
Set5
Dictionary is an unordered collection of key-value pairs. It is
generally used when we have a huge amount of data.
For Example:
www.edureka.co/pythonEDUREKA PYTHON CERTIFICATION TRAINING
Variables
Operators
Conditional
Statements
Loops
Functions
Classes and
Objects
Data types
www.edureka.co/pythonEDUREKA PYTHON CERTIFICATION TRAINING
Python Operations
Operators
Identity
Operators
Membership
Operators
Comparison
Operators
Arithmetic
Operators
Assignment
Operators
Logical
Operators
Bitwise
Operators
Operations Operators are the constructs which can manipulate the value of operands.
www.edureka.co/pythonEDUREKA PYTHON CERTIFICATION TRAINING
Arithmetic and Comparison Operators
Arithmetic Comparison
a + b
a – b
a * b
a / b
a % b
a ** b
Addition
Multiplication
Subtraction
Division
Modulus
Exponent
a == b
a != b
a > b
a < b
a >= b
a <= b
Equal To
Greater Than
Not Equal To
Less Than
Greater Than Equal To
Less Than Equal To
www.edureka.co/pythonEDUREKA PYTHON CERTIFICATION TRAINING
Assignment and identity Operator
Assignment
a = b
a + = b
a - = b
a * = b
a /= b
a** = b
Assigns value from right to left
a = a - b
a = a + b
a = a*b
a = a/b
a = a**b
Identity
is
is not
Evaluates to true if the variables on
either side of the operator point to
the same object and false
otherwise.
Evaluates to false if the variables on
either side of the operator point to
the same object and true otherwise.
www.edureka.co/pythonEDUREKA PYTHON CERTIFICATION TRAINING
Membership and Bitwise Operator
Membership
in
not in
Evaluates to true if it finds a
variable in the specified
sequence and false otherwise.
Evaluates to true if it does not
find a variable in the specified
sequence and false otherwise.
Bitwise
a & b
a | b
a ^ b
a ~ b
a <<
a >> b
Binary AND
Binary OR
Binary XOR
Binary NOT
Binary Left Shift
Binary Right Shift
www.edureka.co/pythonEDUREKA PYTHON CERTIFICATION TRAINING
Logical Operator
There are three types of logical operators: Logical AND, Logical NOT, Logical OR
a and b
a or b
Returns a if a is false, b otherwise
Returns b if b is false, a otherwise
not a Returns True if a is True, False otherwise
www.edureka.co/pythonEDUREKA PYTHON CERTIFICATION TRAINING
Variables Operators
Conditional
Statements
Loops
Functions
Classes and
Objects
Data types
www.edureka.co/pythonEDUREKA PYTHON CERTIFICATION TRAINING
Conditional Statements in Python
If Statement
Syntax:
If code
End
Start
Condition
is true
Condition
Condition
is false
Exit
www.edureka.co/pythonEDUREKA PYTHON CERTIFICATION TRAINING
Conditional Statements in Python
Elif Statement
If code
End
Start
Condition
is true
Condition
If condition is
false
Elif codeSyntax:
www.edureka.co/pythonEDUREKA PYTHON CERTIFICATION TRAINING
Conditional Statements in Python
Else code If code
Elif condition
is false
If condition
is true
Elif code
If condition is
false
Condition
End
StartElse Statement
Syntax:
www.edureka.co/pythonEDUREKA PYTHON CERTIFICATION TRAINING
Variables Operators
Conditional
Statements
Loops
Functions
Classes and
Objects
Data types
www.edureka.co/pythonEDUREKA PYTHON CERTIFICATION TRAINING
Loops in Python
A loop statement allows us to execute a statement or group of statements multiple
times. The following diagram illustrates a loop statement:Loops
Loops
NestedForWhile
Start
Conditional Code
Condition
If condition is
false
If condition is
true
End
www.edureka.co/pythonEDUREKA PYTHON CERTIFICATION TRAINING
While Loop
While Loop
Repeats a statement or group of statements while a given condition is TRUE. It tests
the condition before executing the loop body.
Syntax:
Start
Conditional Code
End
If condition
is true
If condition
is false
Condition
www.edureka.co/pythonEDUREKA PYTHON CERTIFICATION TRAINING
For Loop
For Loop
Repeats a statement or group of statements while a given condition is TRUE. It tests
the condition before executing the loop body.
Syntax:
Start
Execute Statement (s)
End
Next item from
sequence
If no more items in the
sequenceItem from
sequence
www.edureka.co/pythonEDUREKA PYTHON CERTIFICATION TRAINING
Nested Loops in Python
Nested Loops
Python programming language allows use of one loop inside another
loop. This is called Nested Loop, below is the syntax for the same:
Syntax: Syntax:
www.edureka.co/pythonEDUREKA PYTHON CERTIFICATION TRAINING
Variables Operators
Conditional
Statements
Loops
Functions
Classes and
Objects
Data types
www.edureka.co/pythonEDUREKA PYTHON CERTIFICATION TRAINING
Functions in Python
Functions
A function is a block of organized, reusable code that is used to perform a single,
related action.
Functions
Predefined
Functions
User Defined
Functions
Function
Add
Call (3,5)
Call (6,9)
Call (1,5)
Call 1
Call 2
Call 3
Return 8
Return 15
Return 6
www.edureka.co/pythonEDUREKA PYTHON CERTIFICATION TRAINING
Variables Operators
Conditional
Statements
Loops
Functions
Classes and
Objects
Data types
www.edureka.co/pythonEDUREKA PYTHON CERTIFICATION TRAINING
Classes and Objects in Python
Classes and Objects
 A class is the blueprint from which specific objects are created.
 Anything that has a state and behavior is object.
Class
Object
www.edureka.co/pythonEDUREKA PYTHON CERTIFICATION TRAINING
Session In A Minute
Install Python Variables, Data types, Operators
Loops Functions
Conditional Statements
Classes and Objects
www.edureka.co/pythonEDUREKA PYTHON CERTIFICATION TRAINING
Thank You …
Questions/Queries/Feedback

Python Programming | Python Programming For Beginners | Python Tutorial | Edureka

  • 1.
  • 2.
    www.edureka.co/pythonEDUREKA PYTHON CERTIFICATIONTRAINING ➢ Install Python ➢ Install PyCharm - IDE for Python ➢ Python Programming ▪ Variables ▪ Data types ▪ Operators ▪ Conditional Statements ▪ Loops ▪ Functions ▪ Classes and Objects ➢ Summary Agenda
  • 3.
  • 4.
  • 5.
    www.edureka.co/pythonEDUREKA PYTHON CERTIFICATIONTRAINING Variables Data types Operators Conditional Statements Loops Functions Classes and Objects
  • 6.
    www.edureka.co/pythonEDUREKA PYTHON CERTIFICATIONTRAINING Python Variable C=‘edureka’ A = 16 B = 20 C = ‘edureka’ B=20 A=16 Memory Memory Memory Variable Variables are nothing but reserved memory locations to store values. This means that when you create a variable you reserve some space in memory.
  • 7.
    www.edureka.co/pythonEDUREKA PYTHON CERTIFICATIONTRAINING Variables Data types Operators Conditional Statements Loops Functions Classes and Objects
  • 8.
    www.edureka.co/pythonEDUREKA PYTHON CERTIFICATIONTRAINING Data types Python Data types A data type, in programming, is a classification that specifies which type of value a variable has and what type of mathematical, relational or logical operations can be applied to it without causing an error. C=‘edureka’ A = 16 B = 20 C = ‘edureka’ B=20 A=16 Integer Datatype Integer Datatype String Datatype
  • 9.
    www.edureka.co/pythonEDUREKA PYTHON CERTIFICATIONTRAINING Python Data types Data types Numeric List Tuple Strings Set Dictionary
  • 10.
    www.edureka.co/pythonEDUREKA PYTHON CERTIFICATIONTRAINING Tuples Strings Set Dictionary Numeric1 3 4 5 6 Lists32 Numeric Data type  Number data types are used to store numeric values.  There are four different numerical types in Python: A = 16 B = 1.678 C = 2 + i6 D = 909065*35353537 Integer Type Float Type Complex Type Long Type
  • 11.
    www.edureka.co/pythonEDUREKA PYTHON CERTIFICATIONTRAINING Tuples Strings Set Dictionary Numeric1 3 4 5 6 Lists22 List Data type The list is a most versatile datatype available in Python which can be written as a list of comma-separated values (items) between square brackets list1 = ['physics', 'chemistry', 1997, 2000]For example: Accessing Values in Lists Updating List Delete List Elements List Length Concatenation Repetition
  • 12.
    www.edureka.co/pythonEDUREKA PYTHON CERTIFICATIONTRAINING Tuples Data type Tuples Strings Set Dictionary Numeric1 3 4 5 6 Tuples23 Lists32 A tuple is a sequence of immutable Python objects. Tuples are sequences, just like lists. Tup1 = ('physics', 'chemistry', 1997, 2000)For example: Accessing Values in Tuple Updating Tuple Delete Tuple Elements Tuple Length Concatenation Repetition
  • 13.
    www.edureka.co/pythonEDUREKA PYTHON CERTIFICATIONTRAINING String Data type Strings Set Dictionary Numeric1 4 5 6 Lists32 Strings24 Tuples3 A string in Python is a sequence of characters. We can create Strings by enclosing characters in quotes. Python treats single quotes the same as double quotes. Consider the example below: Operation Syntax String Length print(len(string_name)) Locate a character in string print(strig_name.index(“Char")) Count the number of times a character is repeated in a string print(string_name.count("Char")) Print a part of the string print(string_name[start:stop]) Reverse a string print(string_name[::-1]) Convert the letters in a string to upper-case print(string_name.upper()) Convert the letters in a string to lower-case print(string_name.lower()) A = ‘Master Python At edureka’ B = ‘Welcome to edureka!’
  • 14.
    www.edureka.co/pythonEDUREKA PYTHON CERTIFICATIONTRAINING Set Data type Set Dictionary Numeric1 5 6 Lists32 Tuples3 Strings4 Set25 Strings4 Set is an unordered collection of unique items. Set is defined by values separated by comma inside braces { }. For Example:
  • 15.
    www.edureka.co/pythonEDUREKA PYTHON CERTIFICATIONTRAINING Dictionary Data type Dictionary Numeric1 6 Lists32 Tuples3 Strings4 Set5 Strings4 Dictionary26 Set5 Dictionary is an unordered collection of key-value pairs. It is generally used when we have a huge amount of data. For Example:
  • 16.
    www.edureka.co/pythonEDUREKA PYTHON CERTIFICATIONTRAINING Variables Operators Conditional Statements Loops Functions Classes and Objects Data types
  • 17.
    www.edureka.co/pythonEDUREKA PYTHON CERTIFICATIONTRAINING Python Operations Operators Identity Operators Membership Operators Comparison Operators Arithmetic Operators Assignment Operators Logical Operators Bitwise Operators Operations Operators are the constructs which can manipulate the value of operands.
  • 18.
    www.edureka.co/pythonEDUREKA PYTHON CERTIFICATIONTRAINING Arithmetic and Comparison Operators Arithmetic Comparison a + b a – b a * b a / b a % b a ** b Addition Multiplication Subtraction Division Modulus Exponent a == b a != b a > b a < b a >= b a <= b Equal To Greater Than Not Equal To Less Than Greater Than Equal To Less Than Equal To
  • 19.
    www.edureka.co/pythonEDUREKA PYTHON CERTIFICATIONTRAINING Assignment and identity Operator Assignment a = b a + = b a - = b a * = b a /= b a** = b Assigns value from right to left a = a - b a = a + b a = a*b a = a/b a = a**b Identity is is not Evaluates to true if the variables on either side of the operator point to the same object and false otherwise. Evaluates to false if the variables on either side of the operator point to the same object and true otherwise.
  • 20.
    www.edureka.co/pythonEDUREKA PYTHON CERTIFICATIONTRAINING Membership and Bitwise Operator Membership in not in Evaluates to true if it finds a variable in the specified sequence and false otherwise. Evaluates to true if it does not find a variable in the specified sequence and false otherwise. Bitwise a & b a | b a ^ b a ~ b a << a >> b Binary AND Binary OR Binary XOR Binary NOT Binary Left Shift Binary Right Shift
  • 21.
    www.edureka.co/pythonEDUREKA PYTHON CERTIFICATIONTRAINING Logical Operator There are three types of logical operators: Logical AND, Logical NOT, Logical OR a and b a or b Returns a if a is false, b otherwise Returns b if b is false, a otherwise not a Returns True if a is True, False otherwise
  • 22.
    www.edureka.co/pythonEDUREKA PYTHON CERTIFICATIONTRAINING Variables Operators Conditional Statements Loops Functions Classes and Objects Data types
  • 23.
    www.edureka.co/pythonEDUREKA PYTHON CERTIFICATIONTRAINING Conditional Statements in Python If Statement Syntax: If code End Start Condition is true Condition Condition is false Exit
  • 24.
    www.edureka.co/pythonEDUREKA PYTHON CERTIFICATIONTRAINING Conditional Statements in Python Elif Statement If code End Start Condition is true Condition If condition is false Elif codeSyntax:
  • 25.
    www.edureka.co/pythonEDUREKA PYTHON CERTIFICATIONTRAINING Conditional Statements in Python Else code If code Elif condition is false If condition is true Elif code If condition is false Condition End StartElse Statement Syntax:
  • 26.
    www.edureka.co/pythonEDUREKA PYTHON CERTIFICATIONTRAINING Variables Operators Conditional Statements Loops Functions Classes and Objects Data types
  • 27.
    www.edureka.co/pythonEDUREKA PYTHON CERTIFICATIONTRAINING Loops in Python A loop statement allows us to execute a statement or group of statements multiple times. The following diagram illustrates a loop statement:Loops Loops NestedForWhile Start Conditional Code Condition If condition is false If condition is true End
  • 28.
    www.edureka.co/pythonEDUREKA PYTHON CERTIFICATIONTRAINING While Loop While Loop Repeats a statement or group of statements while a given condition is TRUE. It tests the condition before executing the loop body. Syntax: Start Conditional Code End If condition is true If condition is false Condition
  • 29.
    www.edureka.co/pythonEDUREKA PYTHON CERTIFICATIONTRAINING For Loop For Loop Repeats a statement or group of statements while a given condition is TRUE. It tests the condition before executing the loop body. Syntax: Start Execute Statement (s) End Next item from sequence If no more items in the sequenceItem from sequence
  • 30.
    www.edureka.co/pythonEDUREKA PYTHON CERTIFICATIONTRAINING Nested Loops in Python Nested Loops Python programming language allows use of one loop inside another loop. This is called Nested Loop, below is the syntax for the same: Syntax: Syntax:
  • 31.
    www.edureka.co/pythonEDUREKA PYTHON CERTIFICATIONTRAINING Variables Operators Conditional Statements Loops Functions Classes and Objects Data types
  • 32.
    www.edureka.co/pythonEDUREKA PYTHON CERTIFICATIONTRAINING Functions in Python Functions A function is a block of organized, reusable code that is used to perform a single, related action. Functions Predefined Functions User Defined Functions Function Add Call (3,5) Call (6,9) Call (1,5) Call 1 Call 2 Call 3 Return 8 Return 15 Return 6
  • 33.
    www.edureka.co/pythonEDUREKA PYTHON CERTIFICATIONTRAINING Variables Operators Conditional Statements Loops Functions Classes and Objects Data types
  • 34.
    www.edureka.co/pythonEDUREKA PYTHON CERTIFICATIONTRAINING Classes and Objects in Python Classes and Objects  A class is the blueprint from which specific objects are created.  Anything that has a state and behavior is object. Class Object
  • 35.
    www.edureka.co/pythonEDUREKA PYTHON CERTIFICATIONTRAINING Session In A Minute Install Python Variables, Data types, Operators Loops Functions Conditional Statements Classes and Objects
  • 36.
    www.edureka.co/pythonEDUREKA PYTHON CERTIFICATIONTRAINING Thank You … Questions/Queries/Feedback