Professional Documents
Culture Documents
10 Variables
10 Variables
AND OPERATORS
Dr.V.V.Sumanth Kumar
Principal Scientist
ICAR- NAARM
Hyderabad
Variables
• Reserved name memory locations which helps to store values
• Based on datatype variable, interpreter allocates the space in memory and decides
what can be stored in reserved memory
• a b=77 invalid
• a_b=11 valid
• Special characters are not valid
• _a can be valid.
Basic Input Operations
User need to enter required information in the input() function of line code
Syntax: input()
Eg: print(122)
Basic Operators
• Perform operations between variables or values
Types of operators
+ Addition x+y
- subtraction x-y
* multiplication x*y
/ Division x/y
% Modulus x%y
** Exponents x**y
= x=5 x=5
+= x+=7 x=x+7
-= x-=5 x=x-5
Example: Assignment operators
Input Output
Comparison operators
Operator Name Example
== Equal x==y
Input Output
Membership operators
Operator Description Example
Input Output
Identity operators
Operator Description Example
Input Output
Bitwise operators
operator Name Description
| OR X |Y
^ XOR X^Y
Truth Table
A B A&B A|B A^B
0 0 0 0 0
0 1 0 1 1
1 0 0 1 1
1 1 1 1 0