r/learnpython • • Mar 27 '23

Actually using a tuple

Can someone, please, give me a "real-world" example on the use of a tuple? I'm learning through w3schools. The idea of a tuple sort of makes sense, but I have no idea how it would/could be applied.

147 Upvotes

64 comments sorted by

View all comments

4

u/SSJKiDo Mar 27 '23

In real-world projects, you’ll most likely use databases like MySQL, and you need tuple in most of your queries. I’ve been using them in almost every function

1

u/Original-Fortune-622 Mar 27 '23

Say more please

1

u/Wishmaster891 Mar 27 '23

I said it below but when you retrieve data from sql lite it comes out in a tuple. You can then unpack / do whatever you want with it