-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathassignment6_loop.py.py
More file actions
114 lines (82 loc) · 1.49 KB
/
assignment6_loop.py.py
File metadata and controls
114 lines (82 loc) · 1.49 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
print("question no 1")
x=[]
for y in range(0,10):
p=int(input("enter any no: "))
x.append(p)
for y in range(0,10):
print(x[y])
print("\n\n")
print("question no 2")
i=0
while i<12:
print("rahul")
print("\n\n")
print("question no 3")
y=[]
z=[]
for i in range(0,5):
p=int(input("enter any no: "))
y.append(p)
for i in range(0,5):
a=y[i]
p=a*a
z.append(p)
print(z)
print("\n\n")
print("question no 4")
l=[1,7,'abilash',4.5,6,'rahul',8,5.1]
i=[]
s=[]
f=[]
for a in l:
if type(a)==int:
i.append(a)
if type(a)==str:
s.append(a)
if type(a)==float:
f.append(a)
print("integer list is",i)
print("string list is",s)
print('float string is',f)
print("\n\n")
print("question no 5")
k=[]
l=[]
for a in range (1,101):
if a%2==0:
k.append(a)
else:
l.append(a)
print("even no list",k)
print("odd no list",l)
print("\n\n")
print("question no 6")
for i in range(1,5):
for j in range(1,i+1):
print("*",end='')
print("\n")
print("\n\n")
print("question no 7")
d={}
for a in range(0,10):
n=input("enter a key:")
m=input("enter any values: ")
d[n]=m
for key in d.keys():
print(key,d[key])
print(d)
print("\n\n")
print("question no 8")
l=[]
flag=0
for x in range(0,10):
l.append(int(input("enter any no:")))
print(l)
y=int(input("enter any no to serch:"))
for x in l:
if x==y:
l.remove(x) #delete the element
flag=1
print(l)
if flag==0:
print("no not found")