- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to select Python Tuple/Dictionary Values for a given Index?
Items in tuple are indexed. Slice operator allows item of certain index to be accessed
>>> T1=(12, "Ravi", "B.Com FY", 78.50) >>> print (T1[2]) B.Com FY
Items in dictionary are not indexed. Value associated with a certain key is obtained by putting in square bracket. The get() method of dictionary also returns associated value.
>>> D1={"Rollno":12, "class":"B.com FY", "precentage":78.50} >>> print (D1['class']) B.com FY >>> print (D1.get('class')) B.com FY
- Related Articles
- How we can create a dictionary from a given tuple in Python?
- How to print a value for a given key for Python dictionary?
- How to update a Python dictionary values?
- How to index and slice a tuple in Python?
- How can I convert a Python Named tuple to a dictionary?
- Add dictionary to tuple in Python
- Python – Concatenate Tuple to Dictionary Key
- How to get a value for a given key from a Python dictionary?
- How I can convert a Python Tuple into Dictionary?
- How to sum values of a Python dictionary?
- How to replace values in a Python dictionary?
- How to replace values of a Python dictionary?
- Get first index values in tuple of strings in Python
- Python - Filter the negative values from given dictionary
- How to sort a dictionary in Python by values?

Advertisements