Python 1
Python 1
Python Programming
What we give you?
Easy Syntax
More libraries
Why do people use
python?
It is more powerful,
Dynamic typing
Library utilities
Platform Independent
Applications of Python
Web Development
Game Development
Machine Learning and Artificial Intelligence
Data Science and Data Visualization
Desktop GUI
Web Scraping Applications
Business Applications
Audio and Video Applications
Python Syntax
Python Indentation
Indentation refers to the spaces at the
beginning of a code line.
Where in other programming languages the
indentation in code is for readability only, the
indentation in Python is very important.
Python uses indentation to indicate a block of
code.
Example 1
Example 2
Python Variable
It is used to store data or values
In python, do not need to be
declared with any particular type
String variables can be declared
either by using single or double
quotes
Rules for Python variables
0 0 0 0 0 1
0 1 0 1 1 1
1 0 0 1 1 0
1 1 1 1 0 0
Queries
a = 60
b = 13
1. What will be the Output of a & b?
2. What will be the Output of a | b?
3. What will be the Output of a ^ b?
4. What will be the Output of ~a?
5. What will be the Output of a<<1 and a<<2?
6. What will be the Output of a>>1 and a>>2?
Bitwise Operator
Membership Operator
Syntax
while expression:
statement
Example
i=1
while i < 5:
print(‘Python Programming’)
i +=1
Example
my_function()
Example
Addition using function
Calculator using functions
Odd or Even using recursion
Fibonacci using function
Factorial Using Function
LCM of two number using recursion
GCD of 2 numbers using recursion
Prime or not using recursion
Lambda Function
A lambda function is a small anonymous
function.
A lambda function can take any number of
arguments, but can only have one expression.
Syntax
lambda arguments : expression
Map Function
Map is the inbuilt function
It is used to apply a function to all the
elements of sequence.
Syntax
map(function, iterable(s))
Filter Function
Filter is the inbuilt function
It is used to filter the elements of iterables
based on some function (ie., It filter out the
unwanted data).
Syntax
filter(function, iterable(s))
Reduce Function
Reduce is the inbuilt function
reduce() works differently
than map() and filter(). It does not return a new
list based on the function and iterable we've
passed. Instead, it returns a single value.
Syntax
reduce(function, iterable(s))
Oops Concept in Python
class Base1:
<class-suite>
class Derived(Base1):
<class-suite>
Multi-Level Inheritance – It will have one base
class and more than one derived class.
Syntax
class class1:
<class-suite>
class class2(class1):
<class-suite>
class class3(class2):
<class-suite>
.
Multiple Inheritance – It will have more than
one parent class and only one derived class
Syntax
class Base1:
<class-suite>
class Base2:
<class-suite>
.
.
class BaseN:
<class-suite>
class Derived(Base1, Base2, ...... BaseN):
<class-suite>
THANK YOU