chapter-3 Python fundamentals
chapter-3 Python fundamentals
Keywords – Are the words that convey a special meaning to the language compiler
o These are reserved for special purpose and must not be used as
normal identifier.
o Eg- False, del, in, or, while , for, print etc
Conventions
Literals(CONSTANT)
Unary Operators
+ Unary plus
- Unary minus
~ Bitwise complement
not Logical negation
Binary Operators
+,-,*,/,%,**,// Addition,Subtraction,Multiplication,Division,Remainder/
Modulus,**
exponent, floor division
Bitwise Operators
& , ^, | Bitwise AND, Bitwise exclusive OR(XOR) Bitwise OR
Shift operators
<< Shift left
>> Shift right
Identity operators
Is , is not Is the identity same ? , is the identity not same?
Relational operators
<, >, Less than, greater than, less than or equal to, Greater
<=,>=,==,!= than or
equal to, equal to, not equal to
Logical operator
AND, OR Logical AND , Logical OR
Assignment operators
=,/=,+=,*=, Assignment , Assign quotient , Assign sum, Assign
%=,- product, Assign remainder, Assign difference, Assign
=,**=,//= Exponent , Assign
Floor division
Membership operators
Simple Input and output—To get input from user interactively, we can use built
–in function input().
Program to obtain length and breadth of a rectangle and calculate its area
# to input length and breadth of a rectangle and calculate its area Output
Area=length * breadth
Program to obtain Swap two numbers
a,b=b,a
a=20 b=10
print(“a=”, a,” b=”,b)