GK SCIENTIST

General Knowledge One Stop Source
Menu
  • Home
  • Social Science
    • History
    • Political Science
    • Geography
  • Science
    • Physics
    • Chemistry
    • Biology
  • Chemistry Notes
  • Mathematics
  • Computer
  • Tutorial MySQL
  • Tutorial Python
  • Java Tutorial
  • English Grammar
  • English Essay
  • Indian Anthropology
  • Philosophy
  • Solved Paper
  • UPSC
  • Current Content
    • Current Affairs
    • RSTV News
    • Yojana and Kurukshetra Gist
  • Donate
  • Contact Us

If you are interested in advertising to our audience, submit the advertising enquiry form.

Advertising Enquiry
Computer

Tuple in Python

Gk Scientist November 30, 2022 No Comments
Tweet WhatsApp Telegram

Tuple in Python:

We can use the PyCharm code editor for this example. If you do not know about it then follow this link- How to install PyCharm for Python and create a program in it.

(1) A tuple in python is an ordered sequence of elements of different data types, such as integer, float, string, list, or even a tuple. It is a linear data structure which means that the elements are stored in a linear order one after another. Elements of a tuple are enclosed in parentheses (round brackets) and are separated by commas. Like list and string, elements of a tuple can be accessed using index values, starting from 0. A tuple is an immutable data type which means a tuple once created cannot be altered. An attempt to do this would lead to an error. In Python, a tuple is used to handle a large amount of heterogeneous data, without the need to declare many individual variables of different types.

(2) Example of Tuple in Python:

  • Create Tuple in Python as shown below.
Create Tuple in Python - Tuple in Python
  • Access tuple particular value as shown below.
Access tuple particular value in python - Tuple in Python
  • Using a for loop we can iterate through each item in a tuple.

First Method:

iterate python tuple - Tuple in Python

Second Method:

iterate tuple in python another method - Tuple in Python

(3) Tuple Function:

  • min()– Returns the minimum or smallest element of the tuple.
python tuple min function - Tuple in Python
  • max()– Returns the maximum or largest element of the tuple.
python tuple max function - Tuple in Python
  • count()– Returns the number of times the given element appears in the tuple.
python tuple count function - Tuple in Python
  • index()– Returns the index of the first occurrence of the element in the given tuple.
python tuple index function - Tuple in Python
  • sum()– Returns the sum of the elements of the tuple.
python tuple sum function - Tuple in Python

Tutorial Python
Tutorial MySQL
Wireless Networking
Wired Networking
Information Security in E-Commerce
Cloud Computing
FTP (File Transfer Protocol)
Python (programming language)– Wikipedia
Prev Article
Next Article

Related Articles

Python SQLite Join
Python SQLite Join: We can use the PyCharm code editor …
Gk Scientist December 9, 2022 Computer

Python SQLite Join

Install DB Browser for SQLite on Windows
DB Browser for SQLite: (1) Go to Google chrome and …
Gk Scientist December 7, 2022 Computer

Install DB Browser for SQLite on Windows

Java String Methods
Java String Methods: We can use the Eclipse IDE for this …
Gk Scientist January 3, 2023 Computer

Java String Methods

Utility Software
What is Utility Software?  Utility programs also known as service …
Gk Scientist September 30, 2022 Computer

Utility Software

Java FileWriter Class
Java FileWriter Class: We can use the Eclipse IDE for …
Gk Scientist January 13, 2023 Computer

Java FileWriter Class

Python MySQL Sum Function
Python MySQL Sum Function: (1) MySQL Sum function returns the …
Gk Scientist December 16, 2022 Computer

Python MySQL Sum Function

Chr and Ord Function in Python
Chr and Ord Function in Python: We can use the …
Gk Scientist November 26, 2022 Computer

Chr and Ord Function in Python

Python Built-in-Exceptions
Python Built-in-Exceptions: We can use the PyCharm code editor for …
Gk Scientist December 6, 2022 Computer

Python Built-in-Exceptions

Leave a Reply Cancel Reply

Search

  • Popular
  • Recent




GK SCIENTIST

General Knowledge One Stop Source

Information

  • About Us
  • Terms and Condition, Disclaimer
  • Contact Us

Android Apps

  • IAS App For English Medium Students
  • IAS Basics App For English Medium Students
  • IAS Hindi App For Hindi Medium Students
DMCA.com Protection Status

Popular Tags

Biology (33) Biology Questions (88) Chemistry (57) Computer (215) Current Affairs (4) Current Content (0) Economy (17) English Essay (172) English Grammar (75) English Literature (10) Geography (83) History (259) Indian Anthropology (11) Indian Polity (14) JKAS Mains Question Papers (17) Mathematics (68) Moral Science (7) NCERT & Other Boards Books (25) Philosophy (114) Physics (89) Political Science (132) RS TV News (33) Science (553) Social Anthropology (7) Social Science (17) Solved Paper (47) UPSC (7) UPSC Mains Question Papers (26)

Downloads

  • NCERT Books
  • Old NCERT Books
  • NIOS Books For IAS, SSC, and State PSC Exam
  • Tamil Nadu Board Books: Important For UPSC, SSC, and State PSC Exam
  • Modern Indian and World History Notes For IAS Exam
  • UPSC Topper 2013 Gaurav Agrawal Notes For IAS Preparation
  • UPSC IAS Prelims General Studies – Previous Year Papers
  • UPSC Mains Question Papers

Copyright © 2023 GK SCIENTIST
Theme by MyThemeShop.com& Hosted On Cloudways

Ad Blocker Detected

Our website is made possible by displaying online advertisements to our visitors. Please consider supporting us by disabling your ad blocker.

Refresh
 

Loading Comments...