forked from Himank289/python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpython lab 11 july.py
More file actions
186 lines (108 loc) · 2.24 KB
/
Copy pathpython lab 11 july.py
File metadata and controls
186 lines (108 loc) · 2.24 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
print("hello how are you all")
#python program to demonstrate numeric value
a=5
print("type of a ",type(a))
b=5.0
print("\ntype of b:",type(b))
c=2+4
print("\n type of c",type(c))
#creating a list
list=[]
print("initial empty list")
print(list)
list1=["welcome to programming"]
print("\n list with the use of string")
print(list1)
list2=["hello",1,"himank","tyagi"]
print("\n list containing multiple values")
print(list2[0])
print(list2[3])
list3=[[1,2]],["data structure"]
print("\n multi dimensional list")
print(list3)
a=[1,2,"hello","tyagi",7]
print("accessing using positive indices")
print(a[0])
print(a[2])
print("accessing using negative indices ")
print(a[-2])
print(a[-1])
b=[1,"r","p",4,"s"]
b.remove("p")
print(b)
print(b.pop(3))
print(b.pop())
print(b)
c=["hello","tyagi",2,5,"himank"]
print(c.index(2))
print(c.count(2))
c.reverse()
print(c)
d=[23,45,65,46,34,32]
print("initial list")
print(d)
d.remove(23)
print(d)
print(d.pop(3))
print(d.pop())
e=[]
e.append(1)
e.append(3)
e.append("hello")
e.append("himank")
e.append("tyagi")
print("after appending the list")
print(e)
e.insert(1,"hi")
e.insert(4,"hlw")
print(e)
e.extend([7,"python","programming","is","best"])
print(e)
print("line a\n lineb\n line c")
print("linea\t line b\t line c")
print("line a\\tline b\\tline c")
print("linea\\nlineb\\nlinec")
print(r"line a\n lineb\n line c")
print(bool(5))
print(bool(4.56))
print(bool("tools sqa"))
print(bool("tools squery"))
print(bool(0.0))
print(bool(""))
print(bool(''))
f=11
print(f)
f=28.5
print(f)
x=3
y=4
y=pow(3,4)
print(y)
z=-5
print(z)
x=5
y=6
print("addition",x+y)
print("subtarction",x-y)
print("divison",x/y)
print("multiplication",x*y)
print("comparison",x>y)
print("comparison",x<y)
print("comparison",x>=y)
print("comparison",x<=y)
print("comparison",x==y)
print("comparison",x!=y)
x=True
y= False
print("logical",x and y)
print("logical",x or y)
print("logical", not y)
x1=5
y1=5
x2="hello"
y2="hello"
print(x2 is y2)
print(x1 is not y1)
x="hello world"
print( "h" in x)
print("world" not in x)