bool()
False
type(True)
bool
my_str = "siddy"
print(my_str.isalnum())
print(my_str.isupper())
True
False
my_str='sid123'
my_str.isalnum()
True

Lists

type([])
list
list = ['mathematics',100,10,20,122,230]
print(list)
['mathematics', 100, 10, 20, 122, 230]
list[:]
# 100 to 230
list[1:]
[100, 10, 20, 122, 230]
list[1:5]    # left is the same index and right is index we want+1
[100, 10, 20, 122]
print(list)
['mathematics', 100, 10, 20, 122, 230, 'sid', ['sid1', 'sid2'], 'sid', ['sid1', 'sid2'], 'sid', ['sid1', 'sid2']]
list.insert(1,"saxena")
print(list)
['mathematics', 'saxena', 'saxena', 100, 10, 20, 122, 230, 'sid', ['sid1', 'sid2'], 'sid', ['sid1', 'sid2'], 'sid', ['sid1', 'sid2']]
list2 = [1,2,3,4,5]
print(list2)
[1, 2, 3, 4, 5]
list2.extend([6,7])
list2
[1, 2, 3, 4, 5, 6, 7]

operations on list

sum(list2)
28
list2.pop()
7
list2.count(2)
1
list2.index(2,1,4)
1
print(min(list2))
print(max(list2))
1
6
list2*2
[1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6]