Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2026 Crash Course
NEET 2026 Crash Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
184 views
in Computer by (51.9k points)
closed by

When to use tuple or dictionary in Python. Give some examples of programming situations mentioning their usefulness.

1 Answer

+1 vote
by (49.6k points)
selected by
 
Best answer

Tuples are used to store the data which is not intended to change during the course of execution of the program. For example, if the name of months is needed in a program, then the same can be stored in the tuple as generally, the names will either be iterated for a loop or referenced sometimes during the execution of the program.

Dictionary is used to store associative data like student's roll no. and the student's name. Here, the roll no. will act as a key to find the corresponding student's name. The position of the data doesn’t matter as the data can easily be searched by using the corresponding key.

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...