You are on page 1of 2

Python

len
len(str(a))
a='2'
b='3'
a+b=23
print (a)
type(a)=> str
int(a)=>2
int(1)+int(b)=>5
1+'Hello'=> err -TypeError : unsupported operand types for 1+
str(1)+'Hello'=>'1Hello"
a=2222
str(1)+'Hi' =>'2222Hi'
'value for a is'+str(a)=> 'value for a is2222'
my_string='This is my string"
my_string.split() => ['This','is','my','string']
my_string.split(",")
my_string='Hi,Hello,Bye'
my_stringsplit(",") => ['Hi','Hello','Bye']
my_string.split() => ['Hi,Hello,Bye']
a=1+2j
b=1+3j
a+b => 2+5j
a*b => (-5+5j)
a**b
a**(1/2)
a**(1/3)
(a)1/2
(a)1/3
math
date& time
os
a=b=c=10
a=10
b=15
c=20
a,b,c=10,15,20 multi assignments in one single line
print (a)
print (b)
python follows indentation ; any space in the next line will raise indentationer
ror
ipython
jupyter
anaconda
my_string_to_print="Hi I am new"
a=2
b=4
c=a*b
"Multi of " + str(a) + "and " + str(b) + " is: " + str(c)
'Multi of 2 and 4 is: 8'
'Multi of {1} and {0} is {2}'.format(a,b,c)
'Multi of 4 and 2 is 8'
'Hi this is my number {}'.format(2)
'Hi this is my number 2'
Data Structure:

list => list of objects


l1=[1,2,3]
l2=[4,5,6]
l1+l2
len(11)
tuples
dictionaries
l=[1,2,'Hello','Bye']

You might also like