When do you use the list and tuple?

Asked 2 years ago, Updated 2 years ago, 44 views

When do you use the list and tuple in Python?

Some methods return lists and some methods return tuples, and I wonder by what criteria you made them.

"Hello %s you are %s years old" %x #Tuple only available

If you can use both of them instead of just one,

Which one should I use, a list or a tuple?

list python type

2022-09-21 20:04

1 Answers

Because of this nature, tuples are often used when read-only data (const) is required. (Of course, you don't have to put only a single type in the list, so you can use it however you want)


2022-09-21 20:04

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.