Python DATATYPES
Python DATATYPES
x << 2 = 40 (0010
<< Bitwise left shift
1000)
EXAMPLE
x=10
y=11
print( ‘x &y= ‘, x & y)
print( ‘x |y= ‘, x | y)
print( ‘x ^y= ‘, x ^ y)
DATA TYPE IN PYTHON
• Int data type : the int datatype represent an integer number .An
integer number is a number without any decimal point or
fraction part .
• Float datatype :the float data type represents
Floating point numbers .A floating number is a number that
contains a decimal point. Example: 0.5,290.08
Floating numbers can also be written in scientific
notation use ‘e’ or ‘E’ to represent the power of 10. Example x
= 2.5e4.The convenience in scientific notation is that it is
possible to represent very big numbers using less memory.
• Complex data type : A complex number is a number that is written
in the form of a+bj or a + bj .The suffix j or J after b indicates the
square root value of -1.
• FOR EXAMPLE:
PYTHON PROGRAM TO ADD TWO COMPLEX NUMBERS.
C1=2.5+2.5J
C2=3.0-0.5J
C3= C1 + C2
PRINT(“SUM= ”, C3)
Representing Binary ,Octal and
Hexadecimal Numbers
http://docs.python.org/lib/string-methods.html
SEARCHING A STRING
For example −
list1 = ['physics', 'chemistry', 1997, 2000];
print list1 del list1[2];
print "After deleting value at index 2 :
print list1
Output−
['physics', 'chemistry', 1997, 2000]
After deleting value at index 2 : ['physics', 'chemistry', 2000]
Basic List Operations
Python Expression Results Description