Skip to content

Commit fede6a2

Browse files
authored
Update FunctionOnTuple.md
1 parent aa29570 commit fede6a2

1 file changed

Lines changed: 48 additions & 11 deletions

File tree

Data_Structure_In_Python/Tuple/FunctionOnTuple.md

Lines changed: 48 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
## Built in Function For tuple :loudspeaker:
2-
There are number of built in functions are available to process tuple
1+
## Built-in Function For tuple
2+
There are the number of built-in functions are available to process tuple
33

44
### 1.length :straight_ruler:
55
- **len()** function is used to return number of elements inside in tuple.
@@ -11,43 +11,64 @@ len(tuplename)
1111
Example:
1212
```python
1313
mytuple=(1,2,3,5,4,8,4)
14+
15+
#length of tuple
1416
res=len(mytuple)
15-
print(res)
16-
#Result:7
17+
18+
print("Length Of Tuple")
19+
print(res)
20+
```
21+
Output:
22+
```
23+
7
1724
```
1825

19-
### 2.max() :truck:
26+
### 2.max()
2027
- The **max()** method returns the largest element in an iterable or largest of two or more parameters.
2128
Syntax:
2229
```python
2330
max(iterable, *iterables[,key, default])
2431
max(arg1, arg2, *args[, key])
25-
```
32+
```
2633

2734
Example:
2835
```python
2936
mytuple=(1,2,3,5,4,8,4)
37+
#Get Maximum High Element
3038
res=max(mytuple)
39+
print("Max Element")
3140
print(res)
32-
#Result:8
3341
```
42+
Output:
43+
```
44+
Max Element
45+
8
46+
```
47+
3448
### 3.min() :bike:
3549
- The **min()** method returns the smallest element in an iterable or largest of two or more parameters.
3650
Syntax:
3751
```python
3852
min(iterable, *iterables[,key, default])
3953
min(arg1, arg2, *args[, key])
40-
```
54+
```
4155

4256
Example:
4357
```python
4458
mytuple=(1,2,3,5,4,8,4)
59+
60+
#Get Minimum Amount
4561
res=min(mytuple)
62+
print("Min Element")
63+
4664
print(res)
47-
#Result:1
65+
```
66+
Output:
67+
```
68+
1
4869
```
4970

50-
### 4.any() :performing_arts:
71+
### 4.any()
5172
- Return True if any element of the iterable is true
5273
- If the iterable is empty, return False.
5374

@@ -78,8 +99,16 @@ tupl5 = ()
7899
print(any(tupl5))
79100
#Result:False
80101
```
102+
Output:
103+
```
104+
True
105+
False
106+
True
107+
True
108+
False
109+
```
81110

82-
### 5.all() :dolls:
111+
### 5.all()
83112
- Return True if all elements of the iterable are true (or if the iterable is empty)
84113

85114

@@ -110,3 +139,11 @@ tupl5 = ()
110139
print(any(tupl5))
111140
#Result:True
112141
```
142+
Output:
143+
```
144+
True
145+
False
146+
True
147+
True
148+
False
149+
```

0 commit comments

Comments
 (0)