0% found this document useful (0 votes)
5 views2 pages

Understanding Operators in Programming

The document outlines various types of operators in programming, including arithmetic, string, assignment, relational, and logical operators, along with their functions. It also explains the concepts of operator precedence, associativity, conditional statements, and control statements, detailing how they affect program execution. Additionally, it mentions the importance of valid operand and operator combinations in forming expressions and highlights the necessity of proper indentation in Python.

Uploaded by

agrawalrajni2
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views2 pages

Understanding Operators in Programming

The document outlines various types of operators in programming, including arithmetic, string, assignment, relational, and logical operators, along with their functions. It also explains the concepts of operator precedence, associativity, conditional statements, and control statements, detailing how they affect program execution. Additionally, it mentions the importance of valid operand and operator combinations in forming expressions and highlights the necessity of proper indentation in Python.

Uploaded by

agrawalrajni2
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Operators - Operators are the symbols that perform arithmetic and logical operations on the

operands and provide a meaningful result.


1- Arithmetic Operators - These are the operators used to perform basic mathematical
calculations i.e. +,-,*,/. There are two types of Arithmetic operators –
 Unary - These operators operate on only one operand. Eg a = +100.
 Binary – These operators operate on two operands. Eg a+b
2- String Operators - These are the operators which works only with strings. There are two
types of string operators –
 Concatenation Operator – The ‘+’ operator is termed as concatenation operator
when you use it with strings. It is used to concatenate two or more strings.
 Replication Operator – The ’*’ operator is termed as Replication operator when use it
with strings. It is used to replicate a given string a specified number of times.
3- Assignment Operator - It is used to assign a value to a variable. ‘=’.
4- Relational Operator – These are used to show the relationship between operands and
compare two or more expressions. There are six types of relational operators eg - <, <=,
>, >=, == , !=
5- Logical Operator – These are the operators which are used to combine the results of two
or more relational operators. There are three types of logical operators - Not, And and Or
Precedence - The priority order based on which operators are evaluated is called Precedence of
Operator.
Associativity – It tells the direction of execution of the operators ( Left to Right or Right to Left)
when the operators in an expression have the same precedence.
Conditional Statements – In programming language conditional statements cause the program
control to transfer to a specific location depending on the outcome of the conditional expression.
There are three types of Conditional Statements –
 If Statement – The if statement is used when you have to evaluate only one condition.
 If Else statement – It is used when either of the two different actions are to be
performed depending upon the result of the conditional expression.
 If elif else Statements – They provide a compact wat to perform multiple tests on a
condition.
Control Statements – A control structure is a set of statements that controls the flow of
execution in a program.
There are three types of Control statements –
 Sequential – In sequential construct the statements in a program are executed in a
sequential manner where one statement is followed by the other with no possibility of
branching off to another action.
 Conditional – These are also known as Decision Making statements. They cause the
program control to transfer to a specific location depending upon the outcome of the
conditional expression.
 Iterative – These are also known as Looping Statements. They enable the execution of a
set of statements to be repeated till the given condition is true.

 Valid Combination of Operands and Operators forms an Expression.


 Python Interpreter decides which operator should be evaluated first based on their
Precedence and Associativity at run time.
 It is mandatory in Python to indent the statements in the condition body else it will
display error.
 Gottfried Leibniz a German Mathematician credited with invention of Modern Binary
Number System.
 The Place value depends on the position of a digit in the number.
 Computer understands only the Binary Code.

You might also like