Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

Differentiate between String, Array and Tuple in Python3. And where, what to use.

+4 votes
asked Jan 7, 2021 by Pallabesh Maharana (460 points)

I m not getting where to use which one. Help me out....

2 Answers

0 votes
answered Jan 8, 2021 by Jayanthi (160 points)
Firstly, all the 3 you mentioned are different data types in Python.

String is used to store characters.

List and tuple are used when you want to store heterogenous or homogenous sequence of values. You can store string also inside a list/tuple.

List has to be used when your values keeps on changing because list is mutable.

Tuple has to be used when your values do not change because tuple is immutable.
0 votes
answered Jan 29, 2021 by Jeff The Chicken (2,920 points)
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.