SlideShare a Scribd company logo
Python Programming
UNIT 1 : SYLLABUS
• Conceptual introduction: topics in computer science, algorithms;
• Modern computer systems: hardware architecture, data
representation in computers, software and operating system;
• Installing Python; basic syntax, interactive shell, editing, saving, and
running a script.
• The concept of data types; variables, assignments; immutable
variables; numerical types;
• arithmetic operators and expressions; comments in the program;
understanding error messages;
Expressions
Operators
Error Messages
Comments
ARITHMETIC
BITWISE
MEMBERSHI
P
IDENTITY
LOGICAL
COMPARISION
ASSIGNMENT
Operators
Operators
Arithmetic operators: EXPRESSION RESULT
10 + 20 30
40 - 15 25
15 * 10 150
25 / 5 5.0
5 ** 2 25
15 % 2 1
9 // 2 4
9.0 // 2.0 4.0
-11 // 3 - 4
-11.0 // 3 - 4.0
OPERATOR MEANING
+ Addition
- Subtraction
* Multiplication
/ Division
** Exponent
% Modulus
// Floor Division
Operators
Assignment operators:
• There are two types of assignment
statements in Python. They are:
1. Basic assignment statements
2. Augmented assignment
statements
• The simple syntax for a basic
assignment statement is:
variable_name = expression
• Ex :
a = 2 +3
a = a + 2
Operators
• There are two types of assignment
statements in Python. They are:
1. Basic assignment statements
2. Augmented assignment
statements
• We can combine arithmetic operators
in assignments to form an augmented
assignment statement.
a = a + b is written as a + = b
• Here the left-hand side i.e., a is
evaluated first, then value of b is
evaluated and then addition is
performed, and finally the addition
result is written back to a
x = x * 2 is written as x * = 2
Operators
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
**= X ** = 3 X = X ** 3
Operators
Comparison operators:
• Comparison operators are used to
compare two values:
EX:
X = 3, Y = 4, Z = 4
X == Y Output: False
Y == Z Output: True
OPERATOR MEANING 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
Operators
Logical operators:
• Logical operators are used to combine conditional statements:
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)
Operators
Identity operators:
• Identity operators are used to compare the objects, not if they are equal,
but if they are the same object, with the same memory location:
OPERATOR DESCRIPTION EXAMPLE
is
Returns True if both variables are
the same object
x is y
is not
Returns True if both variables are
not the same object
x is not y
Operators
Membership operators:
• Membership operators are used to test if a sequence is presented in an
object:
OPERATOR DESCRIPTION EXAMPLE
in
Returns True if a sequence with the
specified value is present in the object
x in y
not in
Returns True if a sequence with the
specified value is not present in the object
x not in y
Operators
Bitwise operators:
• Bitwise operators
are used to compare
(binary) numbers:
OPERATOR MEANING DESCRIPTION
& AND Sets each bit to 1 if both bits are 1
| OR
Sets each bit to 1 if one of two
bits is 1
^ XOR
Sets each bit to 1 if only one of
two bits is 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
the leftmost bit in from the left,
and let the rightmost bits fall off
ARITHMETIC
BITWISE
MEMBERSHI
P
IDENTITY
LOGICAL
COMPARISION
ASSIGNMENT
Operators
Expressions
Operators
Error Messages
Comments
Expressions
• An expression is a combination of
values(Constants), variables and
operators.
• Instructions that a Python
interpreter can execute are called
statements. For example, a = 1 is
an assignment statement.
• a = 10 # This is an assignment
statement
• b = 10 # This is an assignment
statement
• print(a + b)
o # a + b is an expression
o print(a + b) is a statement
• a = b * 5 + c
o # b * 5 + c is an expression
o a = b * 5 + c is a statement
Consider a=1, b=5, c=6, d=3.
Evaluate b – a * c / d + 10 Answer : 13
Expressions
Expressions
Operators
Error Messages
Comments
Comments
• A comment is a piece of program text that
the computer ignores but that provides
useful documentation to programmers.
• # symbol is used to add comments.
a = 10 # a value assigned
b = 20 # b value assigned
c = a + b # sum of a and b assigned to
c
Expressions
Operators
Error Messages
Comments
Error Messages
How Python Works:
• In python there are three types of errors;
o Syntax errors
o Semantic errors
o Exceptions
Error Messages
• The most common reason of an error in
a Python program is when a certain
statement is not in accordance with the
prescribed usage. Such an error is called
a syntax error.
• When Python encounters a syntax error
in a program, it halts execution with an
error message.
Error Messages
• A semantic error is detected when the
action that an expression describes
cannot be carried out, even though that
expression is syntactically correct.
Expressions
Operators
Error Messages
Comments
UNIT 1 : SYLLABUS
• Conceptual introduction: topics in computer science, algorithms;
• Modern computer systems: hardware architecture, data
representation in computers, software and operating system;
• Installing Python; basic syntax, interactive shell, editing, saving, and
running a script.
• The concept of data types; variables, assignments; immutable
variables; numerical types;
• arithmetic operators and expressions; comments in the program;
understanding error messages;

More Related Content

What's hot (19)

COM1407: C Operators
COM1407: C OperatorsCOM1407: C Operators
COM1407: C Operators
Hemantha Kulathilake
 
C++
C++ C++
C++
umardanjumamaiwada
 
Python operators
Python operatorsPython operators
Python operators
SaurabhUpadhyay73
 
Python Training in Bangalore | Python Operators | Learnbay.in
Python Training in Bangalore | Python Operators | Learnbay.inPython Training in Bangalore | Python Operators | Learnbay.in
Python Training in Bangalore | Python Operators | Learnbay.in
Learnbayin
 
Python operators
Python operatorsPython operators
Python operators
nuripatidar
 
Operators in Python
Operators in PythonOperators in Python
Operators in Python
Anusuya123
 
Operator Precedence and Associativity
Operator Precedence and AssociativityOperator Precedence and Associativity
Operator Precedence and Associativity
Nicole Ynne Estabillo
 
Report on c
Report on cReport on c
Report on c
jasmeen kr
 
Operators in python
Operators in pythonOperators in python
Operators in python
Prabhakaran V M
 
Operators in c programming
Operators in c programmingOperators in c programming
Operators in c programming
savitamhaske
 
CBSE Class XI :- Operators in C++
CBSE Class XI :- Operators in C++CBSE Class XI :- Operators in C++
CBSE Class XI :- Operators in C++
Pranav Ghildiyal
 
Python Operators
Python OperatorsPython Operators
Python Operators
Adheetha O. V
 
Operators
OperatorsOperators
Operators
Kamran
 
Operators in python
Operators in pythonOperators in python
Operators in python
deepalishinkar1
 
Python : basic operators
Python : basic operatorsPython : basic operators
Python : basic operators
S.M. Salaquzzaman
 
C Prog. - Operators and Expressions
C Prog. - Operators and ExpressionsC Prog. - Operators and Expressions
C Prog. - Operators and Expressions
vinay arora
 
What are operators?
What are operators? What are operators?
What are operators?
AnuragSrivastava272
 
Arithmetic operator
Arithmetic operatorArithmetic operator
Arithmetic operator
Jordan Delacruz
 
Python Basic Operators
Python Basic OperatorsPython Basic Operators
Python Basic Operators
Soba Arjun
 
Python Training in Bangalore | Python Operators | Learnbay.in
Python Training in Bangalore | Python Operators | Learnbay.inPython Training in Bangalore | Python Operators | Learnbay.in
Python Training in Bangalore | Python Operators | Learnbay.in
Learnbayin
 
Python operators
Python operatorsPython operators
Python operators
nuripatidar
 
Operators in Python
Operators in PythonOperators in Python
Operators in Python
Anusuya123
 
Operator Precedence and Associativity
Operator Precedence and AssociativityOperator Precedence and Associativity
Operator Precedence and Associativity
Nicole Ynne Estabillo
 
Operators in c programming
Operators in c programmingOperators in c programming
Operators in c programming
savitamhaske
 
CBSE Class XI :- Operators in C++
CBSE Class XI :- Operators in C++CBSE Class XI :- Operators in C++
CBSE Class XI :- Operators in C++
Pranav Ghildiyal
 
Operators
OperatorsOperators
Operators
Kamran
 
C Prog. - Operators and Expressions
C Prog. - Operators and ExpressionsC Prog. - Operators and Expressions
C Prog. - Operators and Expressions
vinay arora
 
Python Basic Operators
Python Basic OperatorsPython Basic Operators
Python Basic Operators
Soba Arjun
 

Similar to Python Programming | JNTUK | UNIT 1 | Lecture 5 (20)

Python programming language introduction unit
Python programming language introduction unitPython programming language introduction unit
Python programming language introduction unit
michaelaaron25322
 
operatorsinpython-18112209560412 (1).pptx
operatorsinpython-18112209560412 (1).pptxoperatorsinpython-18112209560412 (1).pptx
operatorsinpython-18112209560412 (1).pptx
urvashipundir04
 
Operators Concept in Python-N.Kavitha.pptx
Operators Concept in Python-N.Kavitha.pptxOperators Concept in Python-N.Kavitha.pptx
Operators Concept in Python-N.Kavitha.pptx
Kavitha713564
 
Operators in Python Arithmetic Operators
Operators in Python Arithmetic OperatorsOperators in Python Arithmetic Operators
Operators in Python Arithmetic Operators
ramireddyobulakondar
 
python statement, expressions and operators.pptx
python statement, expressions and operators.pptxpython statement, expressions and operators.pptx
python statement, expressions and operators.pptx
richumt
 
Operators_in_Python_Simplified_languages
Operators_in_Python_Simplified_languagesOperators_in_Python_Simplified_languages
Operators_in_Python_Simplified_languages
AbhishekGupta692777
 
Python Lec-6 Operatorguijjjjuugggggs.pptx
Python Lec-6 Operatorguijjjjuugggggs.pptxPython Lec-6 Operatorguijjjjuugggggs.pptx
Python Lec-6 Operatorguijjjjuugggggs.pptx
ks812227
 
python operators.pptx
python operators.pptxpython operators.pptx
python operators.pptx
irsatanoli
 
Python second ppt
Python second pptPython second ppt
Python second ppt
RaginiJain21
 
Python : Operators
Python : OperatorsPython : Operators
Python : Operators
Emertxe Information Technologies Pvt Ltd
 
OPERATORS-PYTHON.pptx ALL OPERATORS ARITHMATIC AND LOGICAL
OPERATORS-PYTHON.pptx   ALL OPERATORS ARITHMATIC AND LOGICALOPERATORS-PYTHON.pptx   ALL OPERATORS ARITHMATIC AND LOGICAL
OPERATORS-PYTHON.pptx ALL OPERATORS ARITHMATIC AND LOGICAL
NagarathnaRajur2
 
PYTHON OPERATORS 123Python Operators.pptx
PYTHON OPERATORS 123Python Operators.pptxPYTHON OPERATORS 123Python Operators.pptx
PYTHON OPERATORS 123Python Operators.pptx
AnjaneyuluKunchala1
 
Data Handling
Data Handling Data Handling
Data Handling
bharath916489
 
Python assignment 1 Biswajit Mohapatra.pptx
Python assignment 1 Biswajit Mohapatra.pptxPython assignment 1 Biswajit Mohapatra.pptx
Python assignment 1 Biswajit Mohapatra.pptx
BiswajitMohapatra59
 
hlukj6;lukm,t.mnjhgjukryopkiu;lyk y2.ppt
hlukj6;lukm,t.mnjhgjukryopkiu;lyk y2.ppthlukj6;lukm,t.mnjhgjukryopkiu;lyk y2.ppt
hlukj6;lukm,t.mnjhgjukryopkiu;lyk y2.ppt
PraveenaFppt
 
Py-Slides-2 (1).ppt
Py-Slides-2 (1).pptPy-Slides-2 (1).ppt
Py-Slides-2 (1).ppt
KalaiVani395886
 
Py-Slides-2.ppt
Py-Slides-2.pptPy-Slides-2.ppt
Py-Slides-2.ppt
TejaValmiki
 
Py-Slides-2.ppt
Py-Slides-2.pptPy-Slides-2.ppt
Py-Slides-2.ppt
AllanGuevarra1
 
Python Operators.pptx
Python Operators.pptxPython Operators.pptx
Python Operators.pptx
M Vishnuvardhan Reddy
 
Python notes for students to develop and learn
Python notes for students to develop and learnPython notes for students to develop and learn
Python notes for students to develop and learn
kavithaadhilakshmi
 
Python programming language introduction unit
Python programming language introduction unitPython programming language introduction unit
Python programming language introduction unit
michaelaaron25322
 
operatorsinpython-18112209560412 (1).pptx
operatorsinpython-18112209560412 (1).pptxoperatorsinpython-18112209560412 (1).pptx
operatorsinpython-18112209560412 (1).pptx
urvashipundir04
 
Operators Concept in Python-N.Kavitha.pptx
Operators Concept in Python-N.Kavitha.pptxOperators Concept in Python-N.Kavitha.pptx
Operators Concept in Python-N.Kavitha.pptx
Kavitha713564
 
Operators in Python Arithmetic Operators
Operators in Python Arithmetic OperatorsOperators in Python Arithmetic Operators
Operators in Python Arithmetic Operators
ramireddyobulakondar
 
python statement, expressions and operators.pptx
python statement, expressions and operators.pptxpython statement, expressions and operators.pptx
python statement, expressions and operators.pptx
richumt
 
Operators_in_Python_Simplified_languages
Operators_in_Python_Simplified_languagesOperators_in_Python_Simplified_languages
Operators_in_Python_Simplified_languages
AbhishekGupta692777
 
Python Lec-6 Operatorguijjjjuugggggs.pptx
Python Lec-6 Operatorguijjjjuugggggs.pptxPython Lec-6 Operatorguijjjjuugggggs.pptx
Python Lec-6 Operatorguijjjjuugggggs.pptx
ks812227
 
python operators.pptx
python operators.pptxpython operators.pptx
python operators.pptx
irsatanoli
 
OPERATORS-PYTHON.pptx ALL OPERATORS ARITHMATIC AND LOGICAL
OPERATORS-PYTHON.pptx   ALL OPERATORS ARITHMATIC AND LOGICALOPERATORS-PYTHON.pptx   ALL OPERATORS ARITHMATIC AND LOGICAL
OPERATORS-PYTHON.pptx ALL OPERATORS ARITHMATIC AND LOGICAL
NagarathnaRajur2
 
PYTHON OPERATORS 123Python Operators.pptx
PYTHON OPERATORS 123Python Operators.pptxPYTHON OPERATORS 123Python Operators.pptx
PYTHON OPERATORS 123Python Operators.pptx
AnjaneyuluKunchala1
 
Python assignment 1 Biswajit Mohapatra.pptx
Python assignment 1 Biswajit Mohapatra.pptxPython assignment 1 Biswajit Mohapatra.pptx
Python assignment 1 Biswajit Mohapatra.pptx
BiswajitMohapatra59
 
hlukj6;lukm,t.mnjhgjukryopkiu;lyk y2.ppt
hlukj6;lukm,t.mnjhgjukryopkiu;lyk y2.ppthlukj6;lukm,t.mnjhgjukryopkiu;lyk y2.ppt
hlukj6;lukm,t.mnjhgjukryopkiu;lyk y2.ppt
PraveenaFppt
 
Python notes for students to develop and learn
Python notes for students to develop and learnPython notes for students to develop and learn
Python notes for students to develop and learn
kavithaadhilakshmi
 
Ad

More from FabMinds (20)

Python Programming | JNTUA | UNIT 3 | Lists |
Python Programming | JNTUA | UNIT 3 | Lists | Python Programming | JNTUA | UNIT 3 | Lists |
Python Programming | JNTUA | UNIT 3 | Lists |
FabMinds
 
Python Programming | JNTUA | UNIT 3 | Strings |
Python Programming | JNTUA | UNIT 3 | Strings | Python Programming | JNTUA | UNIT 3 | Strings |
Python Programming | JNTUA | UNIT 3 | Strings |
FabMinds
 
Python Programming | JNTUA | UNIT 3 | Updating Variables & Iteration |
Python Programming | JNTUA | UNIT 3 | Updating Variables & Iteration | Python Programming | JNTUA | UNIT 3 | Updating Variables & Iteration |
Python Programming | JNTUA | UNIT 3 | Updating Variables & Iteration |
FabMinds
 
Python Programming | JNTUA | UNIT 2 | Case Study |
Python Programming | JNTUA | UNIT 2 | Case Study | Python Programming | JNTUA | UNIT 2 | Case Study |
Python Programming | JNTUA | UNIT 2 | Case Study |
FabMinds
 
Python Programming | JNTUA | UNIT 2 | Fruitful Functions |
Python Programming | JNTUA | UNIT 2 | Fruitful Functions | Python Programming | JNTUA | UNIT 2 | Fruitful Functions |
Python Programming | JNTUA | UNIT 2 | Fruitful Functions |
FabMinds
 
Python Programming | JNTUA | UNIT 2 | Conditionals and Recursion |
Python Programming | JNTUA | UNIT 2 | Conditionals and Recursion | Python Programming | JNTUA | UNIT 2 | Conditionals and Recursion |
Python Programming | JNTUA | UNIT 2 | Conditionals and Recursion |
FabMinds
 
Application layer protocols
Application layer protocolsApplication layer protocols
Application layer protocols
FabMinds
 
Internet connectivity
Internet connectivityInternet connectivity
Internet connectivity
FabMinds
 
Introduction for internet connectivity (IoT)
 Introduction for internet connectivity (IoT) Introduction for internet connectivity (IoT)
Introduction for internet connectivity (IoT)
FabMinds
 
web connectivity in IoT
web connectivity in IoTweb connectivity in IoT
web connectivity in IoT
FabMinds
 
message communication protocols in IoT
message communication protocols in IoTmessage communication protocols in IoT
message communication protocols in IoT
FabMinds
 
web communication protocols in IoT
web communication protocols in IoTweb communication protocols in IoT
web communication protocols in IoT
FabMinds
 
introduction for web connectivity (IoT)
introduction for web connectivity (IoT)introduction for web connectivity (IoT)
introduction for web connectivity (IoT)
FabMinds
 
Python Introduction | JNTUA | R19 | UNIT 1 | Functions
Python Introduction | JNTUA | R19 | UNIT 1 | FunctionsPython Introduction | JNTUA | R19 | UNIT 1 | Functions
Python Introduction | JNTUA | R19 | UNIT 1 | Functions
FabMinds
 
Python Introduction | JNTUA | R19 | UNIT 1 | Functions
Python Introduction | JNTUA | R19 | UNIT 1 | FunctionsPython Introduction | JNTUA | R19 | UNIT 1 | Functions
Python Introduction | JNTUA | R19 | UNIT 1 | Functions
FabMinds
 
Python Programming | JNTUK | UNIT 2 | Lecture 6 & 7 | Conditional & Control S...
Python Programming | JNTUK | UNIT 2 | Lecture 6 & 7 | Conditional & Control S...Python Programming | JNTUK | UNIT 2 | Lecture 6 & 7 | Conditional & Control S...
Python Programming | JNTUK | UNIT 2 | Lecture 6 & 7 | Conditional & Control S...
FabMinds
 
Data enrichment
Data enrichmentData enrichment
Data enrichment
FabMinds
 
Communication technologies
Communication technologiesCommunication technologies
Communication technologies
FabMinds
 
M2M systems layers and designs standardizations
M2M systems layers and designs standardizationsM2M systems layers and designs standardizations
M2M systems layers and designs standardizations
FabMinds
 
Business models for business processes on IoT
Business models for business processes on IoTBusiness models for business processes on IoT
Business models for business processes on IoT
FabMinds
 
Python Programming | JNTUA | UNIT 3 | Lists |
Python Programming | JNTUA | UNIT 3 | Lists | Python Programming | JNTUA | UNIT 3 | Lists |
Python Programming | JNTUA | UNIT 3 | Lists |
FabMinds
 
Python Programming | JNTUA | UNIT 3 | Strings |
Python Programming | JNTUA | UNIT 3 | Strings | Python Programming | JNTUA | UNIT 3 | Strings |
Python Programming | JNTUA | UNIT 3 | Strings |
FabMinds
 
Python Programming | JNTUA | UNIT 3 | Updating Variables & Iteration |
Python Programming | JNTUA | UNIT 3 | Updating Variables & Iteration | Python Programming | JNTUA | UNIT 3 | Updating Variables & Iteration |
Python Programming | JNTUA | UNIT 3 | Updating Variables & Iteration |
FabMinds
 
Python Programming | JNTUA | UNIT 2 | Case Study |
Python Programming | JNTUA | UNIT 2 | Case Study | Python Programming | JNTUA | UNIT 2 | Case Study |
Python Programming | JNTUA | UNIT 2 | Case Study |
FabMinds
 
Python Programming | JNTUA | UNIT 2 | Fruitful Functions |
Python Programming | JNTUA | UNIT 2 | Fruitful Functions | Python Programming | JNTUA | UNIT 2 | Fruitful Functions |
Python Programming | JNTUA | UNIT 2 | Fruitful Functions |
FabMinds
 
Python Programming | JNTUA | UNIT 2 | Conditionals and Recursion |
Python Programming | JNTUA | UNIT 2 | Conditionals and Recursion | Python Programming | JNTUA | UNIT 2 | Conditionals and Recursion |
Python Programming | JNTUA | UNIT 2 | Conditionals and Recursion |
FabMinds
 
Application layer protocols
Application layer protocolsApplication layer protocols
Application layer protocols
FabMinds
 
Internet connectivity
Internet connectivityInternet connectivity
Internet connectivity
FabMinds
 
Introduction for internet connectivity (IoT)
 Introduction for internet connectivity (IoT) Introduction for internet connectivity (IoT)
Introduction for internet connectivity (IoT)
FabMinds
 
web connectivity in IoT
web connectivity in IoTweb connectivity in IoT
web connectivity in IoT
FabMinds
 
message communication protocols in IoT
message communication protocols in IoTmessage communication protocols in IoT
message communication protocols in IoT
FabMinds
 
web communication protocols in IoT
web communication protocols in IoTweb communication protocols in IoT
web communication protocols in IoT
FabMinds
 
introduction for web connectivity (IoT)
introduction for web connectivity (IoT)introduction for web connectivity (IoT)
introduction for web connectivity (IoT)
FabMinds
 
Python Introduction | JNTUA | R19 | UNIT 1 | Functions
Python Introduction | JNTUA | R19 | UNIT 1 | FunctionsPython Introduction | JNTUA | R19 | UNIT 1 | Functions
Python Introduction | JNTUA | R19 | UNIT 1 | Functions
FabMinds
 
Python Introduction | JNTUA | R19 | UNIT 1 | Functions
Python Introduction | JNTUA | R19 | UNIT 1 | FunctionsPython Introduction | JNTUA | R19 | UNIT 1 | Functions
Python Introduction | JNTUA | R19 | UNIT 1 | Functions
FabMinds
 
Python Programming | JNTUK | UNIT 2 | Lecture 6 & 7 | Conditional & Control S...
Python Programming | JNTUK | UNIT 2 | Lecture 6 & 7 | Conditional & Control S...Python Programming | JNTUK | UNIT 2 | Lecture 6 & 7 | Conditional & Control S...
Python Programming | JNTUK | UNIT 2 | Lecture 6 & 7 | Conditional & Control S...
FabMinds
 
Data enrichment
Data enrichmentData enrichment
Data enrichment
FabMinds
 
Communication technologies
Communication technologiesCommunication technologies
Communication technologies
FabMinds
 
M2M systems layers and designs standardizations
M2M systems layers and designs standardizationsM2M systems layers and designs standardizations
M2M systems layers and designs standardizations
FabMinds
 
Business models for business processes on IoT
Business models for business processes on IoTBusiness models for business processes on IoT
Business models for business processes on IoT
FabMinds
 
Ad

Recently uploaded (20)

la storia dell'Inghilterra, letteratura inglese
la storia dell'Inghilterra, letteratura inglesela storia dell'Inghilterra, letteratura inglese
la storia dell'Inghilterra, letteratura inglese
LetiziaLucente
 
Cloud Computing ..PPT ( Faizan ALTAF )..
Cloud Computing ..PPT ( Faizan ALTAF )..Cloud Computing ..PPT ( Faizan ALTAF )..
Cloud Computing ..PPT ( Faizan ALTAF )..
faizanaltaf231
 
Smart Borrowing: Everything You Need to Know About Short Term Loans in India
Smart Borrowing: Everything You Need to Know About Short Term Loans in IndiaSmart Borrowing: Everything You Need to Know About Short Term Loans in India
Smart Borrowing: Everything You Need to Know About Short Term Loans in India
fincrifcontent
 
প্রত্যুৎপন্নমতিত্ব - Prottutponnomotittwa 2025.pdf
প্রত্যুৎপন্নমতিত্ব - Prottutponnomotittwa 2025.pdfপ্রত্যুৎপন্নমতিত্ব - Prottutponnomotittwa 2025.pdf
প্রত্যুৎপন্নমতিত্ব - Prottutponnomotittwa 2025.pdf
Pragya - UEM Kolkata Quiz Club
 
Diana Enriquez Wauconda - A Wauconda-Based Educator
Diana Enriquez Wauconda - A Wauconda-Based EducatorDiana Enriquez Wauconda - A Wauconda-Based Educator
Diana Enriquez Wauconda - A Wauconda-Based Educator
Diana Enriquez Wauconda
 
Coleoptera: The Largest Insect Order.pptx
Coleoptera: The Largest Insect Order.pptxColeoptera: The Largest Insect Order.pptx
Coleoptera: The Largest Insect Order.pptx
Arshad Shaikh
 
Pests of Rice: Damage, Identification, Life history, and Management.pptx
Pests of Rice: Damage, Identification, Life history, and Management.pptxPests of Rice: Damage, Identification, Life history, and Management.pptx
Pests of Rice: Damage, Identification, Life history, and Management.pptx
Arshad Shaikh
 
Trends Spotting Strategic foresight for tomorrow’s education systems - Debora...
Trends Spotting Strategic foresight for tomorrow’s education systems - Debora...Trends Spotting Strategic foresight for tomorrow’s education systems - Debora...
Trends Spotting Strategic foresight for tomorrow’s education systems - Debora...
EduSkills OECD
 
Uterine Prolapse, causes type and classification,its managment
Uterine Prolapse, causes type and classification,its managmentUterine Prolapse, causes type and classification,its managment
Uterine Prolapse, causes type and classification,its managment
Ritu480198
 
Optimization technique in pharmaceutical product development.pptx
Optimization technique in pharmaceutical product development.pptxOptimization technique in pharmaceutical product development.pptx
Optimization technique in pharmaceutical product development.pptx
UrmiPrajapati3
 
How to Configure Add to Cart in Odoo 18 Website
How to Configure Add to Cart in Odoo 18 WebsiteHow to Configure Add to Cart in Odoo 18 Website
How to Configure Add to Cart in Odoo 18 Website
Celine George
 
Forestry Model Exit Exam_2025_Wollega University, Gimbi Campus.pdf
Forestry Model Exit Exam_2025_Wollega University, Gimbi Campus.pdfForestry Model Exit Exam_2025_Wollega University, Gimbi Campus.pdf
Forestry Model Exit Exam_2025_Wollega University, Gimbi Campus.pdf
ChalaKelbessa
 
Artificial intelligence Presented by JM.
Artificial intelligence Presented by JM.Artificial intelligence Presented by JM.
Artificial intelligence Presented by JM.
jmansha170
 
Rose Cultivation Practices by Kushal Lamichhane.pdf
Rose Cultivation Practices by Kushal Lamichhane.pdfRose Cultivation Practices by Kushal Lamichhane.pdf
Rose Cultivation Practices by Kushal Lamichhane.pdf
kushallamichhame
 
SEM II 3202 STRUCTURAL MECHANICS, B ARCH, REGULATION 2021, ANNA UNIVERSITY, R...
SEM II 3202 STRUCTURAL MECHANICS, B ARCH, REGULATION 2021, ANNA UNIVERSITY, R...SEM II 3202 STRUCTURAL MECHANICS, B ARCH, REGULATION 2021, ANNA UNIVERSITY, R...
SEM II 3202 STRUCTURAL MECHANICS, B ARCH, REGULATION 2021, ANNA UNIVERSITY, R...
RVSPSOA
 
Swachata Quiz - Prelims - 01.10.24 - Quiz Club IIT Patna
Swachata Quiz - Prelims - 01.10.24 - Quiz Club IIT PatnaSwachata Quiz - Prelims - 01.10.24 - Quiz Club IIT Patna
Swachata Quiz - Prelims - 01.10.24 - Quiz Club IIT Patna
Quiz Club, Indian Institute of Technology, Patna
 
WRITTEN THEME ROUND- OPEN GENERAL QUIZ.pptx
WRITTEN THEME ROUND- OPEN GENERAL QUIZ.pptxWRITTEN THEME ROUND- OPEN GENERAL QUIZ.pptx
WRITTEN THEME ROUND- OPEN GENERAL QUIZ.pptx
Sourav Kr Podder
 
IDSP(INTEGRATED DISEASE SURVEILLANCE PROGRAMME...
IDSP(INTEGRATED DISEASE SURVEILLANCE PROGRAMME...IDSP(INTEGRATED DISEASE SURVEILLANCE PROGRAMME...
IDSP(INTEGRATED DISEASE SURVEILLANCE PROGRAMME...
SweetytamannaMohapat
 
TV Shows and web-series quiz | QUIZ CLUB OF PSGCAS | 13TH MARCH 2025
TV Shows and web-series quiz | QUIZ CLUB OF PSGCAS | 13TH MARCH 2025TV Shows and web-series quiz | QUIZ CLUB OF PSGCAS | 13TH MARCH 2025
TV Shows and web-series quiz | QUIZ CLUB OF PSGCAS | 13TH MARCH 2025
Quiz Club of PSG College of Arts & Science
 
HUMAN SKELETAL SYSTEM ANATAMY AND PHYSIOLOGY
HUMAN SKELETAL SYSTEM ANATAMY AND PHYSIOLOGYHUMAN SKELETAL SYSTEM ANATAMY AND PHYSIOLOGY
HUMAN SKELETAL SYSTEM ANATAMY AND PHYSIOLOGY
DHARMENDRA SAHU
 
la storia dell'Inghilterra, letteratura inglese
la storia dell'Inghilterra, letteratura inglesela storia dell'Inghilterra, letteratura inglese
la storia dell'Inghilterra, letteratura inglese
LetiziaLucente
 
Cloud Computing ..PPT ( Faizan ALTAF )..
Cloud Computing ..PPT ( Faizan ALTAF )..Cloud Computing ..PPT ( Faizan ALTAF )..
Cloud Computing ..PPT ( Faizan ALTAF )..
faizanaltaf231
 
Smart Borrowing: Everything You Need to Know About Short Term Loans in India
Smart Borrowing: Everything You Need to Know About Short Term Loans in IndiaSmart Borrowing: Everything You Need to Know About Short Term Loans in India
Smart Borrowing: Everything You Need to Know About Short Term Loans in India
fincrifcontent
 
প্রত্যুৎপন্নমতিত্ব - Prottutponnomotittwa 2025.pdf
প্রত্যুৎপন্নমতিত্ব - Prottutponnomotittwa 2025.pdfপ্রত্যুৎপন্নমতিত্ব - Prottutponnomotittwa 2025.pdf
প্রত্যুৎপন্নমতিত্ব - Prottutponnomotittwa 2025.pdf
Pragya - UEM Kolkata Quiz Club
 
Diana Enriquez Wauconda - A Wauconda-Based Educator
Diana Enriquez Wauconda - A Wauconda-Based EducatorDiana Enriquez Wauconda - A Wauconda-Based Educator
Diana Enriquez Wauconda - A Wauconda-Based Educator
Diana Enriquez Wauconda
 
Coleoptera: The Largest Insect Order.pptx
Coleoptera: The Largest Insect Order.pptxColeoptera: The Largest Insect Order.pptx
Coleoptera: The Largest Insect Order.pptx
Arshad Shaikh
 
Pests of Rice: Damage, Identification, Life history, and Management.pptx
Pests of Rice: Damage, Identification, Life history, and Management.pptxPests of Rice: Damage, Identification, Life history, and Management.pptx
Pests of Rice: Damage, Identification, Life history, and Management.pptx
Arshad Shaikh
 
Trends Spotting Strategic foresight for tomorrow’s education systems - Debora...
Trends Spotting Strategic foresight for tomorrow’s education systems - Debora...Trends Spotting Strategic foresight for tomorrow’s education systems - Debora...
Trends Spotting Strategic foresight for tomorrow’s education systems - Debora...
EduSkills OECD
 
Uterine Prolapse, causes type and classification,its managment
Uterine Prolapse, causes type and classification,its managmentUterine Prolapse, causes type and classification,its managment
Uterine Prolapse, causes type and classification,its managment
Ritu480198
 
Optimization technique in pharmaceutical product development.pptx
Optimization technique in pharmaceutical product development.pptxOptimization technique in pharmaceutical product development.pptx
Optimization technique in pharmaceutical product development.pptx
UrmiPrajapati3
 
How to Configure Add to Cart in Odoo 18 Website
How to Configure Add to Cart in Odoo 18 WebsiteHow to Configure Add to Cart in Odoo 18 Website
How to Configure Add to Cart in Odoo 18 Website
Celine George
 
Forestry Model Exit Exam_2025_Wollega University, Gimbi Campus.pdf
Forestry Model Exit Exam_2025_Wollega University, Gimbi Campus.pdfForestry Model Exit Exam_2025_Wollega University, Gimbi Campus.pdf
Forestry Model Exit Exam_2025_Wollega University, Gimbi Campus.pdf
ChalaKelbessa
 
Artificial intelligence Presented by JM.
Artificial intelligence Presented by JM.Artificial intelligence Presented by JM.
Artificial intelligence Presented by JM.
jmansha170
 
Rose Cultivation Practices by Kushal Lamichhane.pdf
Rose Cultivation Practices by Kushal Lamichhane.pdfRose Cultivation Practices by Kushal Lamichhane.pdf
Rose Cultivation Practices by Kushal Lamichhane.pdf
kushallamichhame
 
SEM II 3202 STRUCTURAL MECHANICS, B ARCH, REGULATION 2021, ANNA UNIVERSITY, R...
SEM II 3202 STRUCTURAL MECHANICS, B ARCH, REGULATION 2021, ANNA UNIVERSITY, R...SEM II 3202 STRUCTURAL MECHANICS, B ARCH, REGULATION 2021, ANNA UNIVERSITY, R...
SEM II 3202 STRUCTURAL MECHANICS, B ARCH, REGULATION 2021, ANNA UNIVERSITY, R...
RVSPSOA
 
WRITTEN THEME ROUND- OPEN GENERAL QUIZ.pptx
WRITTEN THEME ROUND- OPEN GENERAL QUIZ.pptxWRITTEN THEME ROUND- OPEN GENERAL QUIZ.pptx
WRITTEN THEME ROUND- OPEN GENERAL QUIZ.pptx
Sourav Kr Podder
 
IDSP(INTEGRATED DISEASE SURVEILLANCE PROGRAMME...
IDSP(INTEGRATED DISEASE SURVEILLANCE PROGRAMME...IDSP(INTEGRATED DISEASE SURVEILLANCE PROGRAMME...
IDSP(INTEGRATED DISEASE SURVEILLANCE PROGRAMME...
SweetytamannaMohapat
 
HUMAN SKELETAL SYSTEM ANATAMY AND PHYSIOLOGY
HUMAN SKELETAL SYSTEM ANATAMY AND PHYSIOLOGYHUMAN SKELETAL SYSTEM ANATAMY AND PHYSIOLOGY
HUMAN SKELETAL SYSTEM ANATAMY AND PHYSIOLOGY
DHARMENDRA SAHU
 

Python Programming | JNTUK | UNIT 1 | Lecture 5

  • 2. UNIT 1 : SYLLABUS • Conceptual introduction: topics in computer science, algorithms; • Modern computer systems: hardware architecture, data representation in computers, software and operating system; • Installing Python; basic syntax, interactive shell, editing, saving, and running a script. • The concept of data types; variables, assignments; immutable variables; numerical types; • arithmetic operators and expressions; comments in the program; understanding error messages;
  • 5. Operators Arithmetic operators: EXPRESSION RESULT 10 + 20 30 40 - 15 25 15 * 10 150 25 / 5 5.0 5 ** 2 25 15 % 2 1 9 // 2 4 9.0 // 2.0 4.0 -11 // 3 - 4 -11.0 // 3 - 4.0 OPERATOR MEANING + Addition - Subtraction * Multiplication / Division ** Exponent % Modulus // Floor Division
  • 6. Operators Assignment operators: • There are two types of assignment statements in Python. They are: 1. Basic assignment statements 2. Augmented assignment statements • The simple syntax for a basic assignment statement is: variable_name = expression • Ex : a = 2 +3 a = a + 2
  • 7. Operators • There are two types of assignment statements in Python. They are: 1. Basic assignment statements 2. Augmented assignment statements • We can combine arithmetic operators in assignments to form an augmented assignment statement. a = a + b is written as a + = b • Here the left-hand side i.e., a is evaluated first, then value of b is evaluated and then addition is performed, and finally the addition result is written back to a x = x * 2 is written as x * = 2
  • 8. Operators 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 **= X ** = 3 X = X ** 3
  • 9. Operators Comparison operators: • Comparison operators are used to compare two values: EX: X = 3, Y = 4, Z = 4 X == Y Output: False Y == Z Output: True OPERATOR MEANING 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
  • 10. Operators Logical operators: • Logical operators are used to combine conditional statements: 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)
  • 11. Operators Identity operators: • Identity operators are used to compare the objects, not if they are equal, but if they are the same object, with the same memory location: OPERATOR DESCRIPTION EXAMPLE is Returns True if both variables are the same object x is y is not Returns True if both variables are not the same object x is not y
  • 12. Operators Membership operators: • Membership operators are used to test if a sequence is presented in an object: OPERATOR DESCRIPTION EXAMPLE in Returns True if a sequence with the specified value is present in the object x in y not in Returns True if a sequence with the specified value is not present in the object x not in y
  • 13. Operators Bitwise operators: • Bitwise operators are used to compare (binary) numbers: OPERATOR MEANING DESCRIPTION & AND Sets each bit to 1 if both bits are 1 | OR Sets each bit to 1 if one of two bits is 1 ^ XOR Sets each bit to 1 if only one of two bits is 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 the leftmost bit in from the left, and let the rightmost bits fall off
  • 16. Expressions • An expression is a combination of values(Constants), variables and operators. • Instructions that a Python interpreter can execute are called statements. For example, a = 1 is an assignment statement. • a = 10 # This is an assignment statement • b = 10 # This is an assignment statement • print(a + b) o # a + b is an expression o print(a + b) is a statement • a = b * 5 + c o # b * 5 + c is an expression o a = b * 5 + c is a statement
  • 17. Consider a=1, b=5, c=6, d=3. Evaluate b – a * c / d + 10 Answer : 13
  • 20. Comments • A comment is a piece of program text that the computer ignores but that provides useful documentation to programmers. • # symbol is used to add comments. a = 10 # a value assigned b = 20 # b value assigned c = a + b # sum of a and b assigned to c
  • 22. Error Messages How Python Works: • In python there are three types of errors; o Syntax errors o Semantic errors o Exceptions
  • 23. Error Messages • The most common reason of an error in a Python program is when a certain statement is not in accordance with the prescribed usage. Such an error is called a syntax error. • When Python encounters a syntax error in a program, it halts execution with an error message.
  • 24. Error Messages • A semantic error is detected when the action that an expression describes cannot be carried out, even though that expression is syntactically correct.
  • 26. UNIT 1 : SYLLABUS • Conceptual introduction: topics in computer science, algorithms; • Modern computer systems: hardware architecture, data representation in computers, software and operating system; • Installing Python; basic syntax, interactive shell, editing, saving, and running a script. • The concept of data types; variables, assignments; immutable variables; numerical types; • arithmetic operators and expressions; comments in the program; understanding error messages;