{"id":5976,"date":"2023-10-29T10:40:40","date_gmt":"2023-10-29T05:10:40","guid":{"rendered":"https:\/\/python-programs.com\/?p=5976"},"modified":"2023-11-10T12:05:37","modified_gmt":"2023-11-10T06:35:37","slug":"python-how-to-find-an-element-in-tuple-by-value","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-how-to-find-an-element-in-tuple-by-value\/","title":{"rendered":"Python : How to Find an Element in Tuple by Value"},"content":{"rendered":"

Tuples are variable types that allow you to store multiple items in a single variable. Tuple is one of Python’s four built-in data types for storing data collections. The other three are List, Set, and Dictionary, each with unique properties and applications. Tuples are collections that are both ordered and immutable.<\/p>\n

Given a tuple, the task is to determine whether or not a given element is present in the tuple.<\/p>\n

Examples:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

given_tuple =( 3,4,5,6,2) element =2<\/pre>\n

Output:<\/strong><\/p>\n

The item is found in the tuple<\/pre>\n

Search an element in Tuple by value<\/h2>\n

There are several ways to search an element in tuple some of them are:<\/p>\n