SlideShare a Scribd company logo
PYTHON
Programming
Introduction to
Python
01
General Purpose
python language is designed for developing software that applies in a wide
range of application domains
02
Interpreted
python uses an interpreter to translate the instructioninto machine
lan
.guage line by line.
03
High level Language
python is very easy to learn and closer to human-readable
language, which is easy to understand
04
Object – Oriented
 Python is a model of programming which aims to work with the real-world entities in
programming. Such as inheritance, data hiding, polymorphism etc. The main concept
of OOP (Object Oriented Programming) is to bind a specific portion of data and
functions together so that no other part, of rest of the code, can access them
History of Python
2008
Python 3.0 (also
called "Py3K") was
released. It was
designed to rectify the
fundamental flaw of the
language.
The implementation of Python
was started in December
1989 by Guido Van
Rossum at CWI in
Netherlandbeautifully
designed.
1989
Python 1.0 was
released with
new features.
1994
Python 3.8
was released
2019
1991
Guido Van
Rossum published the
code (labeled version
0.9.0) to alt.sources.
1980
Python laid its
foundation in the
late 1980
PythonVersion Released Date
Python 1.0 January 1994
Python 1.5 December 31, 1997
Python 1.6 September 5, 2000
Python 2.0 October 16, 2000
Python 2.1 April 17, 2001
Python 2.2 December 21, 2001
Python 2.3 July 29,2003
Python 2.4 November 30, 2004
Python 2.5 September 19,2006
Python 2.6 October 1, 2008
Python programming language is being updated regularly with new features and supports. There are lots
of update in Python versions, started from 1994 to current release.
A list of Python versions with its released date is given below.
PythonVersion Released Date
Python 2.7 July 3, 2010
Python 3.0 December 3, 2008
Python 3.1 June 27,2009
Python 3.2 February 20, 2011
Python 3.3 September 29,2012
Python 3.4 March 16, 2014
Python 3.5 September 13,2015
Python 3.6 December 23, 2016
Python 3.7 June 27,2018
Python 3.8 October 14, 2019
Applications of Python
Web and Internet
Development.
Scientific and
Numeric Operating.
Software
Development
Engineering
Application
Education
Business
Applications.
Enterprise
Applications.
START
FINISH
Python Programming-1.pptx of python by computer
Key Features of Python
Easy to Learn - It is very easy to learn and understand. People of any age group can learn this language very easily.
Its language syntax is very simple to understand.
Free and Open Source - It is a free and open-source programming language and its source code is also available to
the public. You don't have to acquire any licence for its uses.
Interpreted Language - An interpreter is a translator that translates the code line by line into machine level
language and this makes it easier to debug the code. Python uses an interpreter to translate the program from a
high-level language to a machine level language so that the computer can understand our instruction.
Large Standard Library - ALarge Standard Library of already written modules and functions of Python is available
in the market, making the coding easier and quicker in every aspect.
Object-Oriented Language - It supports object-oriented programming which includes concepts of classes, data
abstraction, polymorphism, encapsulation etc.
GUI Programming Support - Python supports programming in Graphical Users Interfaces using already existing
modules, such as PyQT5, wxPython, Tickler etc.
Portable Language - Python supports portability for example if we have a python code for windows and we want to
run this code on another platform such as, Unix, Linux or Mac then we do not need to change it, we can run this
code on any platform.
High-Level Language - Python is a high-level language. It means that it is easy to code, and once we write
programs in python, we do not need to worry about the system architecture, nor do we need to manage the memory
in python manually.
Support Language Integration - Python supports language integration because we can easily integrated python
with other languages like C, C++ etc.
Installation of Python
Installation on Windows
Visit the link https://www.python.org/downloads/ to download the latest release of Python. In
this process, we will install Python 3.8.6 on our Windows operating system. When we click on the
above link, it will bring us the following page.
.
Step - 1: Select the Python's version
to download.
Click on the download button
Step - 2: Click on the Install Now
Double-click the executable file, which is
downloaded; the following window will
open.
Select Customize installation and
proceed.
Click on theAdd Path check box, it will set
the Python path automatically.
Step - 3 Installation in Process
Now, try to run python on
the command prompt.
Type the command
python -version in case
of python3.
download
and install
Python
Latest
Version
on
Android
Download Pydroid 3 – IDE for Python
3 app from Play store
T
o install Pydroid app go to play store
link here –
After installation is
complete, Run the app
and it will show as
installing python.
Working with python
Input and output in Python
Environment Setup for Coding in Python
Environment Setup is the process of installation and configuration of software required for coding programs in
Python. To start coding in Python we need two things:
Text Editor - A text editor is a software used for writing code in Python. Example Windows Notepad, Notepad++,
vim for Linux.
Python Interpreter - A Python interpreter is a software required to interpret your source code into machine-
executable code.
use free software for Python programming. This type of software is known as an IDE (Integrated Development
Environment).
Free IDE software available on the internet for Python programming. You can download any of the software
mentioned below for Python programming.
Spyder
PyDev
IDLE (This is the default IDE that comes with Python.)
Visual Studio Code
Wing Free Version
print() Function and its Use
The print() function is used in the Python program to print text as well as the value
of the variables on the screen.
Example :
print('Hello World')
print("Hello World")
Output :
Hello World
Hello World
Example :
print('Sunday')
print('Monday')
OUTPUT :
Sunday
Monday
VARIABLES IN PYTHON
• A variable in Python is just a human-readable name used to store
data in computer memory.
• A variable is also used in a computer program to store, read and
change the data in computer memory.
• A variable is also known as Identifier because it is used for
identifying values in a computer program.
• When you declare a variable in Python programming language, it
means that you are asking the operating system to reserve a piece
of memory with that variable name for storing data.
What is meant by Data
Data is a collection of facts or figure or combination of both (facts
and figure).
Facts - Any word that is consist of only alphabets is known as Facts.
Example: john, mango, book, etc these words are consist of
only alphabets. So each of them is a data but consist of Facts.
Figure - Any number whether it is whole number or real number is
a Figure.
Example: 15, 84.13, 5486, etc. So each of them is a data but consist of
Figure.
Combination of Both (Facts and Figure) - Anything which is consist
of Facts and Figure is known as Alphanumeric Text.
Example: 13street, alpha56, dx14c5, etc. So each of them is a data
but consist of Alphanumeric Text.
Note : Like other programming languages like C , C++, Python do not have any commands to
create variable
What is Data Type
Data Type in Python is used to classify the value stored in a variable during the program execution.
Whenever a variable is defined in Python, the interpreter allocates some memory according to the
data stored in the variable.
Python supports the following data types given below.
Data Types in Python
Integer - It is used to storewholenumberssuchas 56, 8, 493etc.
ComplexNumber- Itis used to storecomplexnumberwhichis created fromrealnumberssuch as
9+21j, -3-9j, -72+81jetc.A complex numberhastwo partsarealpartand an imaginarypart
. Float- Itis used to storenumberswitha decimalpointsuchas 2.3, 18.12,294.0etc.
Boolean - It is used tostorelogicalvaluessuchas TrueorFalse.String-It is usedto storetext such as
"hello", "Peter", "4586"etc.
Dictionary-It is used to storeanunorderedkeyand itsvaluepairssuch as{"name" :"frankie" ,
"age" : "18"}.
Set - Itis used to storeanunorderedandunindexedcollectionofuniqueobjectssuch as {"a", "b“, "c"}.
List- It is used to storean orderedandchangeablecollectionof objects suchas ["apple", "banana",
"cherry"].
Tuple - Itis used to storean orderedandunchangeablecollectionof objectssuch as (15,"Albert",
18.20)
1. To declare an integer and float variable in python.
x=5
x=4.23
Explanation : we have declared a variable x and assigned the value 5 in it so, it becomes an integer variable. We
can use the same variable to store another type of value in it as you can see, on line number 2 we have used the
same variable name x to store a float value 4.23 in it so, now the variable x becomes a float variable
2. To declare a string variable in python.
y=“Python”
in it so, it becomes a string
Explanation : we have declared a variable y and assigned a string value python
variable .
3. To declare a boolean variable in python.
z=True
Explanation : we have declared a variable z and assigned a boolean value True in it so, it becomes a boolean
variable.
4. To declare multiple variables and assign multiple values in a single line.
a, b, c, d = 5, 4.26, "apple", True
a=5; b=4.26; c="apple"; d=True
Explanation :We have declared 4 variables a, b, c, d and assigned values 5, 4.26, "apple", True respectively in a
single line in two different ways, one using comma (,) and another using semicolon (;).
We Can use any one method that you like. So the value of a is 5, value of b is 4.23, value
of c is apple and value of d is True which becomes a boolean variable.
5. To declare same value inmultiple variablesin a single line.
a=b=c=15
Explanation :We have declared 3variables a, b, c and assigned the same value 15 inall the variables
respectively in a single line.
INPUTAND OUTPUT IN PYTHON
EnvironmentSetupforPythonProgramming
EnvironmentSetupistheprocessof installationandconfigurationofsoftwarerequiredforcoding
programsinPython.TostartcodinginPythonweneed two things:
Text Editor-A text editoris asoftwareused forwritingcodeinPython.ExampleWindowsNotepad,
Notepad++,vimforLinux.
PythonInterpreter - APythoninterpreterisa softwarerequiredtointerpretyoursourcecodeinto
machine-executablecode.
PRINT() FUNCTION : The print() function is used in the Python program to print text as well as the value of
the variables on the screen.
1. Program to print Sunday and Mondayon separate lines using single print() function.
print('SundaynMonday')
print('nSundaynnnMonday')
OUTPUT :
Sunday
Monday
Sunday
Monday
2. (Use of sep (separator) parameter in print() function)
Python program to show the use of sep parameter in print() function.
print('Sunday','Monday',sep='-')
print('18','06','2020',sep='/')
print('is Thursday')
OUTPUT :
Sunday-Monday
18/06/2020
is Thursday
3. (Use of end parameter in print() function)
Python program to show the use of end parameter in print() function.
print('Sunday','Monday',end='-')
print('Tuesday')
print('Wednesday')
OUTPUT :
Sunday Monday-Tuesday
Wednesday
4. (Use of sep and end parameters together in print() function)
print(‘sudha',’nmkrv',sep='',end='@')
print(‘gmail.com')
OUTPUT :
sudhagnmkrv@gmail.com
5. Python program to print integer and float data type values on the screen.
a=10 b=20.32
print('a=',a,' b=',b,sep='',end='nn')
print('a=',a,sep='')
print('b=',b,sep='')
b=20
OUTPUT :a=10
a=10
b=20.32
Print Python Variables and Literals
Program :
number = -10.6
name = "Programiz"
# print literals
print(5)
# print variables
print(number)
print(‘the value of the variable number is ‘ , number)
print(name)
OUTPUT :
5
10.6
Programiz
Print Concatenated Strings
We can also join two strings together inside the print() statement
print('Python is ' + 'awesome.')
OutPut :
Python is awesome
Output formatting
Sometimes we would like to format our output to make it look attractive.
This can be done by using the str.format() method.
x = 5
y = 10
print('The value of x is {} and y is {}'.format(x,y))
Python Input :
Python provides us with two inbuilt functions to read the input from the keyboard.
input ( prompt )
raw_input ( prompt )
input (): This function first takes the input from the user and converts it into a string. The
type of the returned object always will be <class ‘str’>. It does not evaluate the expression
it just returns the complete statement as String
Input(prompt)
prompt is the string we wish to display on the screen. It is optional
# using input() to take user input
num = input('Enter a number: ')
print('You Entered:', num)
Enter a number: 10
You Entered: 10
Operators :
Operators are special symbols that perform operations on variables (name of the values ) and values
Example :
print(5 + 6)
>> 11
Here + is a operator and 5 , 6 are values
Example :2 :
x=10
y=12
print(x+y)
Types of Python Operators
The different types of python operators are as follows :
1. Arithmetic operators
2. Assignment Operators
3. Comparison Operators
4. Logical Operators
5. Bitwise Operators
6. Special Operators
1. Python Arithmetic Operators
Arithmetic operators are used to perform mathematical operations like addition, subtraction, multiplication, etc. For
example,
Operator Operation Example
+ Addition 5 + 2 = 7
- Subtraction 4 - 2 = 2
* Multiplication 2 * 3 = 6
/ Division 4 / 2 = 2
// Floor Division 10 // 3 = 3
% Modulo 5 % 2 = 1
** Power 4 ** 2 = 16
a. Arithmetic Operators
Arithmetic operations between two operands are carried out using arithmetic
operators.
Operator Description
+ (Addition) It is used to add two operands. For example, if a = 10, b = 10 => a+b =
20
- (Subtraction) It is used to subtract the second operand from the first operand. If the
first operand is less than the second operand, the value results
negative. For example, if a = 20, b = 5 => a - b = 15
/ (divide) It returns the quotient after dividing the first operand by the second
operand. For example, if a = 20, b = 10 => a/b = 2.0
* (Multiplication) It is used to multiply one operand with the other. For example, if a = 20,
b = 4 => a * b = 80
% (reminder) It returns the reminder after dividing the first operand by the second
operand. For example, if a = 20, b = 10 => a%b = 0
** (Exponent) As it calculates the first operand's power to the second operand, it is an
exponent operator.
// (Floor division) It provides the quotient's floor value, which is obtained by dividing the
two operands.
a = 7
b = 2
# addition (Comment Statement )
print ('Sum: ', a + b)
# subtraction
print ('Subtraction: ', a - b)
# multiplication
print ('Multiplication: ', a * b)
# division
print ('Division: ', a / b)
# floor division
print ('Floor Division: ', a // b)
# modulo
print ('Modulo: ', a % b)
# a to the power b
print ('Power: ', a ** b)
Program to perform Arithmetic
operation:
1. Write a python program to add three numbers .
2. Write a Python program to calculate the simple interest of an amount :
Formula : (pxnxr ) / 100.
3. Write a python program to calculate the area of a circle :
Formula : (3.14 x r2)
4. Write a python program to calculate area of a square:
Formula : a2
5. Write a python program to add 5 subjects marks and find the average.
6. Write a python program to find the percentage of the above total marks obtained by the student.
7. Write a python program to calculate the area of a triangle :
Formula : 1/2xbxh (b is breath and h is height )
2. Python Assignment Operators
Assignment operators are used to assign values to variables. For example,
Var x=5
list of different assignment operators
Operator Name Example
= Assignment Operator a = 7
+= Addition Assignment a += 1 # a = a + 1
-= Subtraction Assignment a -= 3 # a = a - 3
*= Multiplication Assignment a *= 4 # a = a * 4
/= Division Assignment a /= 3 # a = a / 3
%= Remainder Assignment a %= 10 # a = a % 10
**= Exponent Assignment a **= 10 # a = a ** 10
Operator Description
= It assigns the value of the right expression to the left operand.
+= By multiplying the value of the right operand by the value of the left operand, the
left operand receives a changed value. For example, if a = 10, b = 20 => a+ = b
will be equal to a = a+ b and therefore, a = 30.
-= It decreases the value of the left operand by the value of the right operand and
assigns the modified value back to left operand. For example, if a = 20, b = 10 =>
a- = b will be equal to a = a- b and therefore, a = 10.
*= It multiplies the value of the left operand by the value of the right operand and
assigns the modified value back to then the left operand. For example, if a = 10, b
= 20 => a* = b will be equal to a = a* b and therefore, a = 200.
%= It divides the value of the left operand by the value of the right operand and
assigns the reminder back to the left operand. For example, if a = 20, b = 10 => a
% = b will be equal to a = a % b and therefore, a = 0.
**= a**=b will be equal to a=a**b, for example, if a = 4, b =2, a**=b will assign 4**2 =
16 to a.
//= A//=b will be equal to a = a// b, for example, if a = 4, b = 3, a//=b will assign 4//3 =
1 to a.
# assign 10 to a (Comment statement : this statement will not be printed on the screen )
a = 10
# assign 5 to b
b = 5
# assign the sum of a and b to a
a += b # a = a + b
print(a)
a -= b # a = a – b
print(a)
a *= b # a = a * b
print(a)
a %= b # a= a% b
print(a)
a **=b # a= a ** b
print(a)
a//=b # a= a//b
print(a)
Operator Description
== If the value of two operands is equal, then the condition becomes true.
!= If the value of two operands is not equal, then the condition becomes true.
<= The condition is met if the first operand is smaller than or equal to the second
operand.
>= The condition is met if the first operand is greater than or equal to the second
operand.
> If the first operand is greater than the second operand, then the condition
becomes true.
< If the first operand is less than the second operand, then the condition
becomes tru
Comparison operator
Comparison operators compare the values of the two operands and return a true or false Boolean value
in accordance. The following table lists the comparison operators.
a = 5
b = 2
# equal to operator
print('a == b =', a == b)
# not equal to operator
print('a != b =', a != b)
# greater than operator
print('a > b =', a > b)
# less than operator
print('a < b =', a < b)
# greater than or equal to operator
print('a >= b =', a >= b)
# less than or equal to operator
print('a <= b =', a <= b)
OUTPUT :
a == b = False
a != b = True
a > b = True
a < b = False
a >= b = True
a <= b = False
FormattingSymbols Description
%d Used for integer printing
%i Used for integer printing
%f Used for decimal number (float) printing
%c Used for character printing
%s Used for string (text) printing
%o Used for octal number printing
%x Used for lowercase hexadecimal number printing
%X Used for uppercase hexadecimal number printing
List of FormattingSymbols
list of symbols used with % operatorfor formatting outputs on the screen.
Escape Sequence Character in Python
An escape sequence is a sequence of characters that does not represent itself when used
inside a character or string literal, but is translated into another character or a sequence of
characters that may be difficult or impossible to represent directly
Escape Sequence Character Description
n Insert a linefeed (new line)
r Insert a carriage return
f Insert a form feed
b Insert a backspace
t Insert a tab
 Insert a backslash
" Insert a double quote
' Insert a single quote
Frequently Asked Questions
1. What is Python Programming Language
2. History of Python
3. Applications of Python
4. Key Features of Python
5. Installation of Python on a Computer
6. How to use output function to print / write the values in Python
7. How to use input function to read the integer vales in python
8. How to do read(input ) and write (output) the string value in python
9. What are variables
10.What are Data
11. What are the different data types in python
12. Write a note on data types
13. What are different types of operators supported in python, explain with examples

More Related Content

Similar to Python Programming-1.pptx of python by computer (20)

Python fundamentals
Python fundamentalsPython fundamentals
Python fundamentals
natnaelmamuye
 
Python Programming
Python ProgrammingPython Programming
Python Programming
shahid sultan
 
Introduction-to-Python-Programming1.pptx
Introduction-to-Python-Programming1.pptxIntroduction-to-Python-Programming1.pptx
Introduction-to-Python-Programming1.pptx
vijayalakshmi257551
 
Chapter - 1.pptx
Chapter - 1.pptxChapter - 1.pptx
Chapter - 1.pptx
MikialeTesfamariam
 
Fundamentals of python
Fundamentals of pythonFundamentals of python
Fundamentals of python
BijuAugustian
 
university notes Lecture - 1 (Python) E-Notes.pptx
university notes Lecture - 1 (Python) E-Notes.pptxuniversity notes Lecture - 1 (Python) E-Notes.pptx
university notes Lecture - 1 (Python) E-Notes.pptx
7ja1nyx
 
Python unit1
Python unit1Python unit1
Python unit1
charvi parth Lastpatel
 
Python basics
Python basicsPython basics
Python basics
ssuser4e32df
 
Python Tutorial | Python Programming Language
Python Tutorial | Python Programming LanguagePython Tutorial | Python Programming Language
Python Tutorial | Python Programming Language
anaveenkumar4
 
python programminig and introduction.pptx
python programminig and introduction.pptxpython programminig and introduction.pptx
python programminig and introduction.pptx
urvashipundir04
 
Free Python Notes PDF - Python Crash Course
Free Python Notes PDF - Python Crash CourseFree Python Notes PDF - Python Crash Course
Free Python Notes PDF - Python Crash Course
Amend Ed Tech
 
Python_Introduction_Good_PPT.pptx
Python_Introduction_Good_PPT.pptxPython_Introduction_Good_PPT.pptx
Python_Introduction_Good_PPT.pptx
lemonchoos
 
Introduction python
Introduction pythonIntroduction python
Introduction python
Jumbo Techno e_Learning
 
Python - An Introduction
Python - An IntroductionPython - An Introduction
Python - An Introduction
Swarit Wadhe
 
UNIT 1 PYTHON introduction and basic level
UNIT 1 PYTHON introduction and basic levelUNIT 1 PYTHON introduction and basic level
UNIT 1 PYTHON introduction and basic level
vasankarponnapalli2
 
Introduction to python for Beginners
Introduction to python for Beginners Introduction to python for Beginners
Introduction to python for Beginners
Sujith Kumar
 
Research paper on python by Rj
Research paper on python by RjResearch paper on python by Rj
Research paper on python by Rj
Shree M.L.Kakadiya MCA mahila college, Amreli
 
kecs105.pdf
kecs105.pdfkecs105.pdf
kecs105.pdf
A23AyushRajBaranwal
 
Introduction to Python Unit -1 Part .pdf
Introduction to Python Unit -1 Part .pdfIntroduction to Python Unit -1 Part .pdf
Introduction to Python Unit -1 Part .pdf
VaibhavKumarSinghkal
 
PYTHON FEATURES.pptx
PYTHON FEATURES.pptxPYTHON FEATURES.pptx
PYTHON FEATURES.pptx
MaheShiva
 
Introduction-to-Python-Programming1.pptx
Introduction-to-Python-Programming1.pptxIntroduction-to-Python-Programming1.pptx
Introduction-to-Python-Programming1.pptx
vijayalakshmi257551
 
Fundamentals of python
Fundamentals of pythonFundamentals of python
Fundamentals of python
BijuAugustian
 
university notes Lecture - 1 (Python) E-Notes.pptx
university notes Lecture - 1 (Python) E-Notes.pptxuniversity notes Lecture - 1 (Python) E-Notes.pptx
university notes Lecture - 1 (Python) E-Notes.pptx
7ja1nyx
 
Python Tutorial | Python Programming Language
Python Tutorial | Python Programming LanguagePython Tutorial | Python Programming Language
Python Tutorial | Python Programming Language
anaveenkumar4
 
python programminig and introduction.pptx
python programminig and introduction.pptxpython programminig and introduction.pptx
python programminig and introduction.pptx
urvashipundir04
 
Free Python Notes PDF - Python Crash Course
Free Python Notes PDF - Python Crash CourseFree Python Notes PDF - Python Crash Course
Free Python Notes PDF - Python Crash Course
Amend Ed Tech
 
Python_Introduction_Good_PPT.pptx
Python_Introduction_Good_PPT.pptxPython_Introduction_Good_PPT.pptx
Python_Introduction_Good_PPT.pptx
lemonchoos
 
Python - An Introduction
Python - An IntroductionPython - An Introduction
Python - An Introduction
Swarit Wadhe
 
UNIT 1 PYTHON introduction and basic level
UNIT 1 PYTHON introduction and basic levelUNIT 1 PYTHON introduction and basic level
UNIT 1 PYTHON introduction and basic level
vasankarponnapalli2
 
Introduction to python for Beginners
Introduction to python for Beginners Introduction to python for Beginners
Introduction to python for Beginners
Sujith Kumar
 
Introduction to Python Unit -1 Part .pdf
Introduction to Python Unit -1 Part .pdfIntroduction to Python Unit -1 Part .pdf
Introduction to Python Unit -1 Part .pdf
VaibhavKumarSinghkal
 
PYTHON FEATURES.pptx
PYTHON FEATURES.pptxPYTHON FEATURES.pptx
PYTHON FEATURES.pptx
MaheShiva
 

Recently uploaded (20)

What are the benefits that dance brings?
What are the benefits that dance brings?What are the benefits that dance brings?
What are the benefits that dance brings?
memi27
 
EUPHORIA GENERAL QUIZ FINALS | QUIZ CLUB OF PSGCAS | 21 MARCH 2025
EUPHORIA GENERAL QUIZ FINALS | QUIZ CLUB OF PSGCAS | 21 MARCH 2025EUPHORIA GENERAL QUIZ FINALS | QUIZ CLUB OF PSGCAS | 21 MARCH 2025
EUPHORIA GENERAL QUIZ FINALS | QUIZ CLUB OF PSGCAS | 21 MARCH 2025
Quiz Club of PSG College of Arts & Science
 
june 10 2025 ppt for madden on art science is over.pptx
june 10 2025 ppt for madden on art science is over.pptxjune 10 2025 ppt for madden on art science is over.pptx
june 10 2025 ppt for madden on art science is over.pptx
roger malina
 
Energy Balances Of Oecd Countries 2011 Iea Statistics 1st Edition Oecd
Energy Balances Of Oecd Countries 2011 Iea Statistics 1st Edition OecdEnergy Balances Of Oecd Countries 2011 Iea Statistics 1st Edition Oecd
Energy Balances Of Oecd Countries 2011 Iea Statistics 1st Edition Oecd
razelitouali
 
MATERI PPT TOPIK 1 LANDASAN FILOSOFIS PENDIDIKAN
MATERI PPT TOPIK 1 LANDASAN FILOSOFIS PENDIDIKANMATERI PPT TOPIK 1 LANDASAN FILOSOFIS PENDIDIKAN
MATERI PPT TOPIK 1 LANDASAN FILOSOFIS PENDIDIKAN
aditya23173
 
Parenting Teens: Supporting Trust, resilience and independence
Parenting Teens: Supporting Trust, resilience and independenceParenting Teens: Supporting Trust, resilience and independence
Parenting Teens: Supporting Trust, resilience and independence
Pooky Knightsmith
 
Respiratory System , Urinary System
Respiratory  System , Urinary SystemRespiratory  System , Urinary System
Respiratory System , Urinary System
RushiMandali
 
FEBA Sofia Univercity final diplian v3 GSDG 5.2025.pdf
FEBA Sofia Univercity final diplian v3 GSDG 5.2025.pdfFEBA Sofia Univercity final diplian v3 GSDG 5.2025.pdf
FEBA Sofia Univercity final diplian v3 GSDG 5.2025.pdf
ChristinaFortunova
 
Analysis of Quantitative Data Parametric and non-parametric tests.pptx
Analysis of Quantitative Data Parametric and non-parametric tests.pptxAnalysis of Quantitative Data Parametric and non-parametric tests.pptx
Analysis of Quantitative Data Parametric and non-parametric tests.pptx
Shrutidhara2
 
How to Manage Upselling of Subscriptions in Odoo 18
How to Manage Upselling of Subscriptions in Odoo 18How to Manage Upselling of Subscriptions in Odoo 18
How to Manage Upselling of Subscriptions in Odoo 18
Celine George
 
How to Create an Event in Odoo 18 - Odoo 18 Slides
How to Create an Event in Odoo 18 - Odoo 18 SlidesHow to Create an Event in Odoo 18 - Odoo 18 Slides
How to Create an Event in Odoo 18 - Odoo 18 Slides
Celine George
 
THERAPEUTIC COMMUNICATION included definition, characteristics, nurse patient...
THERAPEUTIC COMMUNICATION included definition, characteristics, nurse patient...THERAPEUTIC COMMUNICATION included definition, characteristics, nurse patient...
THERAPEUTIC COMMUNICATION included definition, characteristics, nurse patient...
parmarjuli1412
 
LDMMIA Reiki Yoga Next Week Grad Updates
LDMMIA Reiki Yoga Next Week Grad UpdatesLDMMIA Reiki Yoga Next Week Grad Updates
LDMMIA Reiki Yoga Next Week Grad Updates
LDM & Mia eStudios
 
How to Configure Vendor Management in Lunch App of Odoo 18
How to Configure Vendor Management in Lunch App of Odoo 18How to Configure Vendor Management in Lunch App of Odoo 18
How to Configure Vendor Management in Lunch App of Odoo 18
Celine George
 
What is FIle and explanation of text files.pptx
What is FIle and explanation of text files.pptxWhat is FIle and explanation of text files.pptx
What is FIle and explanation of text files.pptx
Ramakrishna Reddy Bijjam
 
Nice Dream.pdf /
Nice Dream.pdf                              /Nice Dream.pdf                              /
Nice Dream.pdf /
ErinUsher3
 
Capitol Doctoral Presentation -June 2025.pptx
Capitol Doctoral Presentation -June 2025.pptxCapitol Doctoral Presentation -June 2025.pptx
Capitol Doctoral Presentation -June 2025.pptx
CapitolTechU
 
Black and White Illustrative Group Project Presentation.pdf (1).pdf
Black and White Illustrative Group Project Presentation.pdf (1).pdfBlack and White Illustrative Group Project Presentation.pdf (1).pdf
Black and White Illustrative Group Project Presentation.pdf (1).pdf
AnnasofiaUrsini
 
IDF 30min presentation - December 2, 2024.pptx
IDF 30min presentation - December 2, 2024.pptxIDF 30min presentation - December 2, 2024.pptx
IDF 30min presentation - December 2, 2024.pptx
ArneeAgligar
 
BUSINESS QUIZ PRELIMS | QUIZ CLUB OF PSGCAS | 9 SEPTEMBER 2024
BUSINESS QUIZ PRELIMS | QUIZ CLUB OF PSGCAS | 9 SEPTEMBER 2024BUSINESS QUIZ PRELIMS | QUIZ CLUB OF PSGCAS | 9 SEPTEMBER 2024
BUSINESS QUIZ PRELIMS | QUIZ CLUB OF PSGCAS | 9 SEPTEMBER 2024
Quiz Club of PSG College of Arts & Science
 
What are the benefits that dance brings?
What are the benefits that dance brings?What are the benefits that dance brings?
What are the benefits that dance brings?
memi27
 
june 10 2025 ppt for madden on art science is over.pptx
june 10 2025 ppt for madden on art science is over.pptxjune 10 2025 ppt for madden on art science is over.pptx
june 10 2025 ppt for madden on art science is over.pptx
roger malina
 
Energy Balances Of Oecd Countries 2011 Iea Statistics 1st Edition Oecd
Energy Balances Of Oecd Countries 2011 Iea Statistics 1st Edition OecdEnergy Balances Of Oecd Countries 2011 Iea Statistics 1st Edition Oecd
Energy Balances Of Oecd Countries 2011 Iea Statistics 1st Edition Oecd
razelitouali
 
MATERI PPT TOPIK 1 LANDASAN FILOSOFIS PENDIDIKAN
MATERI PPT TOPIK 1 LANDASAN FILOSOFIS PENDIDIKANMATERI PPT TOPIK 1 LANDASAN FILOSOFIS PENDIDIKAN
MATERI PPT TOPIK 1 LANDASAN FILOSOFIS PENDIDIKAN
aditya23173
 
Parenting Teens: Supporting Trust, resilience and independence
Parenting Teens: Supporting Trust, resilience and independenceParenting Teens: Supporting Trust, resilience and independence
Parenting Teens: Supporting Trust, resilience and independence
Pooky Knightsmith
 
Respiratory System , Urinary System
Respiratory  System , Urinary SystemRespiratory  System , Urinary System
Respiratory System , Urinary System
RushiMandali
 
FEBA Sofia Univercity final diplian v3 GSDG 5.2025.pdf
FEBA Sofia Univercity final diplian v3 GSDG 5.2025.pdfFEBA Sofia Univercity final diplian v3 GSDG 5.2025.pdf
FEBA Sofia Univercity final diplian v3 GSDG 5.2025.pdf
ChristinaFortunova
 
Analysis of Quantitative Data Parametric and non-parametric tests.pptx
Analysis of Quantitative Data Parametric and non-parametric tests.pptxAnalysis of Quantitative Data Parametric and non-parametric tests.pptx
Analysis of Quantitative Data Parametric and non-parametric tests.pptx
Shrutidhara2
 
How to Manage Upselling of Subscriptions in Odoo 18
How to Manage Upselling of Subscriptions in Odoo 18How to Manage Upselling of Subscriptions in Odoo 18
How to Manage Upselling of Subscriptions in Odoo 18
Celine George
 
How to Create an Event in Odoo 18 - Odoo 18 Slides
How to Create an Event in Odoo 18 - Odoo 18 SlidesHow to Create an Event in Odoo 18 - Odoo 18 Slides
How to Create an Event in Odoo 18 - Odoo 18 Slides
Celine George
 
THERAPEUTIC COMMUNICATION included definition, characteristics, nurse patient...
THERAPEUTIC COMMUNICATION included definition, characteristics, nurse patient...THERAPEUTIC COMMUNICATION included definition, characteristics, nurse patient...
THERAPEUTIC COMMUNICATION included definition, characteristics, nurse patient...
parmarjuli1412
 
LDMMIA Reiki Yoga Next Week Grad Updates
LDMMIA Reiki Yoga Next Week Grad UpdatesLDMMIA Reiki Yoga Next Week Grad Updates
LDMMIA Reiki Yoga Next Week Grad Updates
LDM & Mia eStudios
 
How to Configure Vendor Management in Lunch App of Odoo 18
How to Configure Vendor Management in Lunch App of Odoo 18How to Configure Vendor Management in Lunch App of Odoo 18
How to Configure Vendor Management in Lunch App of Odoo 18
Celine George
 
What is FIle and explanation of text files.pptx
What is FIle and explanation of text files.pptxWhat is FIle and explanation of text files.pptx
What is FIle and explanation of text files.pptx
Ramakrishna Reddy Bijjam
 
Nice Dream.pdf /
Nice Dream.pdf                              /Nice Dream.pdf                              /
Nice Dream.pdf /
ErinUsher3
 
Capitol Doctoral Presentation -June 2025.pptx
Capitol Doctoral Presentation -June 2025.pptxCapitol Doctoral Presentation -June 2025.pptx
Capitol Doctoral Presentation -June 2025.pptx
CapitolTechU
 
Black and White Illustrative Group Project Presentation.pdf (1).pdf
Black and White Illustrative Group Project Presentation.pdf (1).pdfBlack and White Illustrative Group Project Presentation.pdf (1).pdf
Black and White Illustrative Group Project Presentation.pdf (1).pdf
AnnasofiaUrsini
 
IDF 30min presentation - December 2, 2024.pptx
IDF 30min presentation - December 2, 2024.pptxIDF 30min presentation - December 2, 2024.pptx
IDF 30min presentation - December 2, 2024.pptx
ArneeAgligar
 
Ad

Python Programming-1.pptx of python by computer

  • 3. 01 General Purpose python language is designed for developing software that applies in a wide range of application domains 02 Interpreted python uses an interpreter to translate the instructioninto machine lan .guage line by line. 03 High level Language python is very easy to learn and closer to human-readable language, which is easy to understand 04 Object – Oriented  Python is a model of programming which aims to work with the real-world entities in programming. Such as inheritance, data hiding, polymorphism etc. The main concept of OOP (Object Oriented Programming) is to bind a specific portion of data and functions together so that no other part, of rest of the code, can access them
  • 4. History of Python 2008 Python 3.0 (also called "Py3K") was released. It was designed to rectify the fundamental flaw of the language. The implementation of Python was started in December 1989 by Guido Van Rossum at CWI in Netherlandbeautifully designed. 1989 Python 1.0 was released with new features. 1994 Python 3.8 was released 2019 1991 Guido Van Rossum published the code (labeled version 0.9.0) to alt.sources. 1980 Python laid its foundation in the late 1980
  • 5. PythonVersion Released Date Python 1.0 January 1994 Python 1.5 December 31, 1997 Python 1.6 September 5, 2000 Python 2.0 October 16, 2000 Python 2.1 April 17, 2001 Python 2.2 December 21, 2001 Python 2.3 July 29,2003 Python 2.4 November 30, 2004 Python 2.5 September 19,2006 Python 2.6 October 1, 2008 Python programming language is being updated regularly with new features and supports. There are lots of update in Python versions, started from 1994 to current release. A list of Python versions with its released date is given below. PythonVersion Released Date Python 2.7 July 3, 2010 Python 3.0 December 3, 2008 Python 3.1 June 27,2009 Python 3.2 February 20, 2011 Python 3.3 September 29,2012 Python 3.4 March 16, 2014 Python 3.5 September 13,2015 Python 3.6 December 23, 2016 Python 3.7 June 27,2018 Python 3.8 October 14, 2019
  • 6. Applications of Python Web and Internet Development. Scientific and Numeric Operating. Software Development Engineering Application Education Business Applications. Enterprise Applications. START FINISH
  • 8. Key Features of Python Easy to Learn - It is very easy to learn and understand. People of any age group can learn this language very easily. Its language syntax is very simple to understand. Free and Open Source - It is a free and open-source programming language and its source code is also available to the public. You don't have to acquire any licence for its uses. Interpreted Language - An interpreter is a translator that translates the code line by line into machine level language and this makes it easier to debug the code. Python uses an interpreter to translate the program from a high-level language to a machine level language so that the computer can understand our instruction. Large Standard Library - ALarge Standard Library of already written modules and functions of Python is available in the market, making the coding easier and quicker in every aspect. Object-Oriented Language - It supports object-oriented programming which includes concepts of classes, data abstraction, polymorphism, encapsulation etc. GUI Programming Support - Python supports programming in Graphical Users Interfaces using already existing modules, such as PyQT5, wxPython, Tickler etc. Portable Language - Python supports portability for example if we have a python code for windows and we want to run this code on another platform such as, Unix, Linux or Mac then we do not need to change it, we can run this code on any platform. High-Level Language - Python is a high-level language. It means that it is easy to code, and once we write programs in python, we do not need to worry about the system architecture, nor do we need to manage the memory in python manually. Support Language Integration - Python supports language integration because we can easily integrated python with other languages like C, C++ etc.
  • 9. Installation of Python Installation on Windows Visit the link https://www.python.org/downloads/ to download the latest release of Python. In this process, we will install Python 3.8.6 on our Windows operating system. When we click on the above link, it will bring us the following page. . Step - 1: Select the Python's version to download. Click on the download button
  • 10. Step - 2: Click on the Install Now Double-click the executable file, which is downloaded; the following window will open. Select Customize installation and proceed. Click on theAdd Path check box, it will set the Python path automatically.
  • 11. Step - 3 Installation in Process
  • 12. Now, try to run python on the command prompt. Type the command python -version in case of python3.
  • 13. download and install Python Latest Version on Android Download Pydroid 3 – IDE for Python 3 app from Play store T o install Pydroid app go to play store link here –
  • 14. After installation is complete, Run the app and it will show as installing python.
  • 15. Working with python Input and output in Python Environment Setup for Coding in Python Environment Setup is the process of installation and configuration of software required for coding programs in Python. To start coding in Python we need two things: Text Editor - A text editor is a software used for writing code in Python. Example Windows Notepad, Notepad++, vim for Linux. Python Interpreter - A Python interpreter is a software required to interpret your source code into machine- executable code. use free software for Python programming. This type of software is known as an IDE (Integrated Development Environment). Free IDE software available on the internet for Python programming. You can download any of the software mentioned below for Python programming. Spyder PyDev IDLE (This is the default IDE that comes with Python.) Visual Studio Code Wing Free Version
  • 16. print() Function and its Use The print() function is used in the Python program to print text as well as the value of the variables on the screen. Example : print('Hello World') print("Hello World") Output : Hello World Hello World Example : print('Sunday') print('Monday') OUTPUT : Sunday Monday
  • 17. VARIABLES IN PYTHON • A variable in Python is just a human-readable name used to store data in computer memory. • A variable is also used in a computer program to store, read and change the data in computer memory. • A variable is also known as Identifier because it is used for identifying values in a computer program. • When you declare a variable in Python programming language, it means that you are asking the operating system to reserve a piece of memory with that variable name for storing data.
  • 18. What is meant by Data Data is a collection of facts or figure or combination of both (facts and figure). Facts - Any word that is consist of only alphabets is known as Facts. Example: john, mango, book, etc these words are consist of only alphabets. So each of them is a data but consist of Facts. Figure - Any number whether it is whole number or real number is a Figure. Example: 15, 84.13, 5486, etc. So each of them is a data but consist of Figure. Combination of Both (Facts and Figure) - Anything which is consist of Facts and Figure is known as Alphanumeric Text. Example: 13street, alpha56, dx14c5, etc. So each of them is a data but consist of Alphanumeric Text. Note : Like other programming languages like C , C++, Python do not have any commands to create variable
  • 19. What is Data Type Data Type in Python is used to classify the value stored in a variable during the program execution. Whenever a variable is defined in Python, the interpreter allocates some memory according to the data stored in the variable. Python supports the following data types given below.
  • 20. Data Types in Python Integer - It is used to storewholenumberssuchas 56, 8, 493etc. ComplexNumber- Itis used to storecomplexnumberwhichis created fromrealnumberssuch as 9+21j, -3-9j, -72+81jetc.A complex numberhastwo partsarealpartand an imaginarypart . Float- Itis used to storenumberswitha decimalpointsuchas 2.3, 18.12,294.0etc. Boolean - It is used tostorelogicalvaluessuchas TrueorFalse.String-It is usedto storetext such as "hello", "Peter", "4586"etc. Dictionary-It is used to storeanunorderedkeyand itsvaluepairssuch as{"name" :"frankie" , "age" : "18"}. Set - Itis used to storeanunorderedandunindexedcollectionofuniqueobjectssuch as {"a", "b“, "c"}. List- It is used to storean orderedandchangeablecollectionof objects suchas ["apple", "banana", "cherry"]. Tuple - Itis used to storean orderedandunchangeablecollectionof objectssuch as (15,"Albert", 18.20)
  • 21. 1. To declare an integer and float variable in python. x=5 x=4.23 Explanation : we have declared a variable x and assigned the value 5 in it so, it becomes an integer variable. We can use the same variable to store another type of value in it as you can see, on line number 2 we have used the same variable name x to store a float value 4.23 in it so, now the variable x becomes a float variable 2. To declare a string variable in python. y=“Python” in it so, it becomes a string Explanation : we have declared a variable y and assigned a string value python variable . 3. To declare a boolean variable in python. z=True Explanation : we have declared a variable z and assigned a boolean value True in it so, it becomes a boolean variable. 4. To declare multiple variables and assign multiple values in a single line. a, b, c, d = 5, 4.26, "apple", True a=5; b=4.26; c="apple"; d=True Explanation :We have declared 4 variables a, b, c, d and assigned values 5, 4.26, "apple", True respectively in a single line in two different ways, one using comma (,) and another using semicolon (;). We Can use any one method that you like. So the value of a is 5, value of b is 4.23, value of c is apple and value of d is True which becomes a boolean variable.
  • 22. 5. To declare same value inmultiple variablesin a single line. a=b=c=15 Explanation :We have declared 3variables a, b, c and assigned the same value 15 inall the variables respectively in a single line. INPUTAND OUTPUT IN PYTHON EnvironmentSetupforPythonProgramming EnvironmentSetupistheprocessof installationandconfigurationofsoftwarerequiredforcoding programsinPython.TostartcodinginPythonweneed two things: Text Editor-A text editoris asoftwareused forwritingcodeinPython.ExampleWindowsNotepad, Notepad++,vimforLinux. PythonInterpreter - APythoninterpreterisa softwarerequiredtointerpretyoursourcecodeinto machine-executablecode.
  • 23. PRINT() FUNCTION : The print() function is used in the Python program to print text as well as the value of the variables on the screen. 1. Program to print Sunday and Mondayon separate lines using single print() function. print('SundaynMonday') print('nSundaynnnMonday') OUTPUT : Sunday Monday Sunday Monday 2. (Use of sep (separator) parameter in print() function) Python program to show the use of sep parameter in print() function. print('Sunday','Monday',sep='-') print('18','06','2020',sep='/') print('is Thursday') OUTPUT : Sunday-Monday 18/06/2020 is Thursday
  • 24. 3. (Use of end parameter in print() function) Python program to show the use of end parameter in print() function. print('Sunday','Monday',end='-') print('Tuesday') print('Wednesday') OUTPUT : Sunday Monday-Tuesday Wednesday 4. (Use of sep and end parameters together in print() function) print(‘sudha',’nmkrv',sep='',end='@') print(‘gmail.com') OUTPUT : [email protected] 5. Python program to print integer and float data type values on the screen. a=10 b=20.32 print('a=',a,' b=',b,sep='',end='nn') print('a=',a,sep='') print('b=',b,sep='') b=20 OUTPUT :a=10 a=10 b=20.32
  • 25. Print Python Variables and Literals Program : number = -10.6 name = "Programiz" # print literals print(5) # print variables print(number) print(‘the value of the variable number is ‘ , number) print(name) OUTPUT : 5 10.6 Programiz
  • 26. Print Concatenated Strings We can also join two strings together inside the print() statement print('Python is ' + 'awesome.') OutPut : Python is awesome Output formatting Sometimes we would like to format our output to make it look attractive. This can be done by using the str.format() method. x = 5 y = 10 print('The value of x is {} and y is {}'.format(x,y))
  • 27. Python Input : Python provides us with two inbuilt functions to read the input from the keyboard. input ( prompt ) raw_input ( prompt ) input (): This function first takes the input from the user and converts it into a string. The type of the returned object always will be <class ‘str’>. It does not evaluate the expression it just returns the complete statement as String Input(prompt) prompt is the string we wish to display on the screen. It is optional # using input() to take user input num = input('Enter a number: ') print('You Entered:', num) Enter a number: 10 You Entered: 10
  • 28. Operators : Operators are special symbols that perform operations on variables (name of the values ) and values Example : print(5 + 6) >> 11 Here + is a operator and 5 , 6 are values Example :2 : x=10 y=12 print(x+y) Types of Python Operators The different types of python operators are as follows : 1. Arithmetic operators 2. Assignment Operators 3. Comparison Operators 4. Logical Operators 5. Bitwise Operators 6. Special Operators
  • 29. 1. Python Arithmetic Operators Arithmetic operators are used to perform mathematical operations like addition, subtraction, multiplication, etc. For example, Operator Operation Example + Addition 5 + 2 = 7 - Subtraction 4 - 2 = 2 * Multiplication 2 * 3 = 6 / Division 4 / 2 = 2 // Floor Division 10 // 3 = 3 % Modulo 5 % 2 = 1 ** Power 4 ** 2 = 16
  • 30. a. Arithmetic Operators Arithmetic operations between two operands are carried out using arithmetic operators. Operator Description + (Addition) It is used to add two operands. For example, if a = 10, b = 10 => a+b = 20 - (Subtraction) It is used to subtract the second operand from the first operand. If the first operand is less than the second operand, the value results negative. For example, if a = 20, b = 5 => a - b = 15 / (divide) It returns the quotient after dividing the first operand by the second operand. For example, if a = 20, b = 10 => a/b = 2.0 * (Multiplication) It is used to multiply one operand with the other. For example, if a = 20, b = 4 => a * b = 80 % (reminder) It returns the reminder after dividing the first operand by the second operand. For example, if a = 20, b = 10 => a%b = 0 ** (Exponent) As it calculates the first operand's power to the second operand, it is an exponent operator. // (Floor division) It provides the quotient's floor value, which is obtained by dividing the two operands.
  • 31. a = 7 b = 2 # addition (Comment Statement ) print ('Sum: ', a + b) # subtraction print ('Subtraction: ', a - b) # multiplication print ('Multiplication: ', a * b) # division print ('Division: ', a / b) # floor division print ('Floor Division: ', a // b) # modulo print ('Modulo: ', a % b) # a to the power b print ('Power: ', a ** b) Program to perform Arithmetic operation:
  • 32. 1. Write a python program to add three numbers . 2. Write a Python program to calculate the simple interest of an amount : Formula : (pxnxr ) / 100. 3. Write a python program to calculate the area of a circle : Formula : (3.14 x r2) 4. Write a python program to calculate area of a square: Formula : a2 5. Write a python program to add 5 subjects marks and find the average. 6. Write a python program to find the percentage of the above total marks obtained by the student. 7. Write a python program to calculate the area of a triangle : Formula : 1/2xbxh (b is breath and h is height )
  • 33. 2. Python Assignment Operators Assignment operators are used to assign values to variables. For example, Var x=5 list of different assignment operators Operator Name Example = Assignment Operator a = 7 += Addition Assignment a += 1 # a = a + 1 -= Subtraction Assignment a -= 3 # a = a - 3 *= Multiplication Assignment a *= 4 # a = a * 4 /= Division Assignment a /= 3 # a = a / 3 %= Remainder Assignment a %= 10 # a = a % 10 **= Exponent Assignment a **= 10 # a = a ** 10
  • 34. Operator Description = It assigns the value of the right expression to the left operand. += By multiplying the value of the right operand by the value of the left operand, the left operand receives a changed value. For example, if a = 10, b = 20 => a+ = b will be equal to a = a+ b and therefore, a = 30. -= It decreases the value of the left operand by the value of the right operand and assigns the modified value back to left operand. For example, if a = 20, b = 10 => a- = b will be equal to a = a- b and therefore, a = 10. *= It multiplies the value of the left operand by the value of the right operand and assigns the modified value back to then the left operand. For example, if a = 10, b = 20 => a* = b will be equal to a = a* b and therefore, a = 200. %= It divides the value of the left operand by the value of the right operand and assigns the reminder back to the left operand. For example, if a = 20, b = 10 => a % = b will be equal to a = a % b and therefore, a = 0. **= a**=b will be equal to a=a**b, for example, if a = 4, b =2, a**=b will assign 4**2 = 16 to a. //= A//=b will be equal to a = a// b, for example, if a = 4, b = 3, a//=b will assign 4//3 = 1 to a.
  • 35. # assign 10 to a (Comment statement : this statement will not be printed on the screen ) a = 10 # assign 5 to b b = 5 # assign the sum of a and b to a a += b # a = a + b print(a) a -= b # a = a – b print(a) a *= b # a = a * b print(a) a %= b # a= a% b print(a) a **=b # a= a ** b print(a) a//=b # a= a//b print(a)
  • 36. Operator Description == If the value of two operands is equal, then the condition becomes true. != If the value of two operands is not equal, then the condition becomes true. <= The condition is met if the first operand is smaller than or equal to the second operand. >= The condition is met if the first operand is greater than or equal to the second operand. > If the first operand is greater than the second operand, then the condition becomes true. < If the first operand is less than the second operand, then the condition becomes tru Comparison operator Comparison operators compare the values of the two operands and return a true or false Boolean value in accordance. The following table lists the comparison operators.
  • 37. a = 5 b = 2 # equal to operator print('a == b =', a == b) # not equal to operator print('a != b =', a != b) # greater than operator print('a > b =', a > b) # less than operator print('a < b =', a < b) # greater than or equal to operator print('a >= b =', a >= b) # less than or equal to operator print('a <= b =', a <= b) OUTPUT : a == b = False a != b = True a > b = True a < b = False a >= b = True a <= b = False
  • 38. FormattingSymbols Description %d Used for integer printing %i Used for integer printing %f Used for decimal number (float) printing %c Used for character printing %s Used for string (text) printing %o Used for octal number printing %x Used for lowercase hexadecimal number printing %X Used for uppercase hexadecimal number printing List of FormattingSymbols list of symbols used with % operatorfor formatting outputs on the screen.
  • 39. Escape Sequence Character in Python An escape sequence is a sequence of characters that does not represent itself when used inside a character or string literal, but is translated into another character or a sequence of characters that may be difficult or impossible to represent directly Escape Sequence Character Description n Insert a linefeed (new line) r Insert a carriage return f Insert a form feed b Insert a backspace t Insert a tab Insert a backslash " Insert a double quote ' Insert a single quote
  • 40. Frequently Asked Questions 1. What is Python Programming Language 2. History of Python 3. Applications of Python 4. Key Features of Python 5. Installation of Python on a Computer 6. How to use output function to print / write the values in Python 7. How to use input function to read the integer vales in python 8. How to do read(input ) and write (output) the string value in python 9. What are variables 10.What are Data 11. What are the different data types in python 12. Write a note on data types 13. What are different types of operators supported in python, explain with examples