If you are looking for notes Tuple functions and methods Class 11 you are landed on the right page. Here we are going to discuss Comprehensive notes Tuple functions and methods Class 11. Before starting if you missed the articles how to create tuples and QnA creating tuples follow the below given links:

Now let’s start the article Comprehensive notes Tuple functions and methods Class 11. Here we go!

## Comprehensive notes Tuple functions and methods Class 11

As we already covered list methods, similarly we tuple functions and methods. These functions and methods are one of the topics of Class 11 curriculum. So in this article we discuss some standard library methods or functions, and tuple methods and function used to manipulate the tuples in Comprehensive notes Tuple functions and methods Class 11.

## Standard Library Methods

In this category for Comprehensive notes Tuple functions and methods Class 11, we will discuss abut following standard library methods.

- len()
- max()
- min()
- sum()
- sorted()

### len() function

This function returns the length of a tuple. The length of tuple means total number of elements present in the list.

For example,

```
t = (22,44,56,78)
print("The tuple contains",len(t), " elements")
```

### max() function

The max function returns the maximum value from the specified tuple.

```
t=(1,3,5,7,8,4,2)
print(max(t))
```

In string it will return the highest ordered letter as maximum.

```
t=('c','b','a','x','u','t')
print(max(t)
```

This function will only work with tuples having similar data type only. If multiple datatypes combined in the single tuple and you want to print the max() value this function won’t work.

## min() function

It will returns minimum value from the sequence specified in the tuple.

```
t=(34,56,78,21,33)
print(min(t))
```

Rest min() will work as max().

### sum() function

It will return the sum of values used in the tuple sequence.

```
t=(34,56,789,99)
print(sum(t))
```

This function only works with numeric elements.

## sorted() function

It will returns the tuple elements in ascending or descending order in form of list.

```
t=(7,3,4,1,2)
print(sorted(t))
```

For descending order use reverse=True as another parameter. Have a look at this code:

```
t=(7,3,4,1,2)
print(sorted(t, reverse=True))
```

## Tuple Methods or Functions

In this category we are using methods or function with dot symbol. These methods or functions are as following:

- tuple()
- index()
- count()

## tuple() function

As we have seen in the tuple creation, this function convert any sequence of lists into tuple.

### index() function

It will return the index of specified tuple element value.

```
t=(2,5,6,7,8)
print(t.index(6))
```

The output of above code is 2.

### count() function

This function will display number of frequency of elements available in the tuple.

```
t=(2,3,4,2,3,4,6,7,8,2)
print(t.count(2))
```

Above code will return 3 as output as 2 is repeated 3 times in the tuple.

## Linear search in the tuple

To search in tuple, follow these steps:

- Start with the leftmost element in the tuple
- Take one variable to flag the message element found on 1
- Take a variable to search an element
- Traverse the tuple using for loop
- Compare the element with the search element
- Update the flag variable to 1
- Outside the loop, print a message element found or not, using if for the flag variable

```
def search():
t = (3,4,1,5,6,8)
f=0
n = int(input("Enter the value to search:"))
for i in range(len(t)):
if t[i] == n:
f=1
if f==1:
print("Found")
else:
print("Not Found")
```

## Mean of values stored in the tuple

To find the mean of values in tuple, follow the below given steps:

- Import a package statistics
- Define the tuple with the values
- Declare a variable to store the mean of tuple values
- The mean can be displayed with float value so use round function to restrict its decimal places
- Use print to print the final value

Observe the following code:

```
import statistics
t = (1, 3, 4, 5, 7, 9, 2 )
meanoftuple = round(statistics.mean(t) ,2)
print("Mean is :", meanoftuple)
```

That’s all from the topic Tuple functions and methods Class 11. I hope that all the concepts are clear to you. If any specific doubt or query you have, you are free to ask through the comment section.

Share your views on this article as your token of love and support.

Thank you very much for reading this article.

If you are looking for more contents for Class 11, follow the below given link: