-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtupple and set.txt
More file actions
32 lines (23 loc) · 1 KB
/
tupple and set.txt
File metadata and controls
32 lines (23 loc) · 1 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
tupple and SET
tupple is almost like an list but tupple is immutable we cant change the value of tupple
the speed of iteration is far more than list so it that is why you used the enhance the speed of execution
define of tupple
tup=(28,10,39)
it is immutable
>>> tup=(29,129,239,32)
>>> tup
(29, 129, 239, 32)
>>> tup.index(32)
3
>>> tup=(29,292,29,29)
>>> tup.count(29)
3
we can only perform two method on tupple such as index and count .
index it is used to find the index number of value
count is used to find the number of time the value occure
SET
set is basically a collection of unique element
we can define the SET by using
s={2893,219,392,'naknd'}
when we print this value we can get random value not in the same sequence we can get iin random sequence .set using the concept of hash and using hash we improve the performance we want to fetch element as fast as possible
indexing is not supporting in set