-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpython_day2.py
50 lines (36 loc) · 918 Bytes
/
python_day2.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
###List###
a = [1,2,4,65,95]
b = [9,8]
a.append(b)
print("After appending A to B",a)
a.extend(b)
print("After extending A yo B",a)
maximum= [1,9,-10,9]
print("Finding the Max of the list",max(maximum))
print("Finding the Min of the list",min(maximum))
###Tuples###
"""Tuples are immutable"""
z = (1,2,3,4,5,6,7)
print(z.index(1))
###Sets###
""" No repetation is repeated"""
"""set1 ={1,2,3,4 }
set1.add(0)
print(set1)
#a.remove(0)
print(set1)
a.discard(0)
print(set1)"""
##Dictionary##
d = {"name": "namratha", "last_name": "kaipa", "gender" :"Female"}
print("This is the type of dictionary:",type(d))
print("The items in the dictionary is:",d.items())
print("The length of the items is: ",len(d.items()))
print("The itemsin the dictionary is: ",d.items())
for k, v in d.items():
print(k, ":", v)
# Creating a new pair
d["city"] ='bangalore'
print("Adding the new pair",d)
del d['city']
print(d)