Python 3 Programming Tutorial - Lists and Tuples

preview_player
Показать описание
In this programming tutorial, we cover Python lists and tuples.

Both data structures contain data, but are slightly different. Python lists are mutable, meaning they can be changed and manipulated. Tuples are immutable, meaning they cannot be changed. This is what sets them apart and why you would use a specific one. Lists are usually more popular, since people want to be able to change them, but tuples are also useful when you do not want or need to change the data.

It should also be noted that Tuples are faster to process and iterate through, so this gives them a bonus, again, if you are not needing to manipulate them.

Bitcoin donations: 1GV7srgR4NJx4vrk7avCmmVQQrqmv87ty6
Рекомендации по теме
Комментарии
Автор

Why do I love this nerdy guy so much?! He is teaching very useful stuff and no BS at all!!!! Too bad I just found this gem among all the YouTubers.

TXfoxie
Автор

Tuples come from more functional languages and are for example used as arguments or return values without the need to create a full class/object (should there even be objects).And usually tuples are collections that have different types of items ("heterogeneous") whereas lists are composed of items of the same type ("homogeneous"). There are even programming languages that require lists to always have the same item type. Python doesn't seem to.A line of a CSV file read in as a tuple makes sense or as we have seen sockets use (host, port) pairs. Or like using a tuple for a vector (x, y) because x has no meaning without y and vice-versa, there is an "intimate" relationship (same argument could be made for host, port). F# has guidance for this e. g. regarding function parameters.

TechLord
Автор

Best tutorials ever. Not sure why these videos even have dislikes on them.

chrisc.
Автор

This is EXACTLY what I needed. Thank you for taking the time to make it and helping people like me out.

helpmenowmark
Автор

It would seem the main purpose of a tuple is protecting its data integrity throughout the execution of the script. (January, February, March, ...)

AnthonyVipond
Автор

Dam Dude! You just totally explained lists and tuples in 5:50 min and I has to sit in a 3 hour class to get a bunch of nothing. Thanks.

ULMQues
Автор

You are the only who is my Inspiration for python ! That's called as passion. Hats off !

prasaddalavi
Автор

ive never enjoyed watching tutorials like this wow. The videos are short and interesting. i wana get lazy but i cant. i just keep watching

ariaalex
Автор

you know brother :)
I started watching your videos and I cannot stop :D
I really appreciate your efforts and I really thank you.
In my religion we say something better than thanking which is "Jazakom Allah Khayran"
So I do both I thank you and I say "Jazakom Allah Khayran = I ask Allah to give you the best always ....Ameen"
All my respect and regards

mohamedgabr
Автор

"Round brackets" heheheh :-)

robertwoodruff
Автор

Holy shit, I just had a "OH FUCK I GOT IT" moment. Thanks! :D:D

cmdrkapp
Автор

I'm no Python expert, but I've been using C for a long time and therefore I'm familiar with how much different data types requires space and how fast can they perform.
Speaking from this perspective, I would highly recommend Tuples to be used as arrays with a fixed size. Lists are way easier to handle if you have manipulations and therefore a dynamic size, However put in mind that it comes with a cost of performance and Memory.
Why would someone go for a tuple ? Simple enough, to save memory.

jisagamers
Автор

I love your videos, man. The addition of the video box was really nice. This is 2014 so I'm sure you've made even more improvements since then. I'm developing a game for fun and you're helping me further my understanding of the Python language. What playlist would you recommend I begin watching after I learn more of the basics? I saw one using PyGame, but I'll probably end up watching a bunch of others just to make sure I know the core language in-and-out.

ianrees
Автор

Will it not be x = exampleFunc()? because in the case of x, y = exampleFunc(), it will declare simple integer variables to hold the returned values. right? I ran to confirm it and it is working the way I am suggesting.

asbat
Автор

i am confused if the methods that we use for list can be applied into the tuples..i print(dir)) to figure out but i ddnt..For example ma, reduuce, filter can be applied>?

oddnumber
Автор

What are the direct 2 methods to construct a tuple that has only a single item? How many ways are there to construct a list with a single item?

prabhuhiremath
Автор

Massive video bro it helped me to understand the concept soon

gowthamansubramanian
Автор

Hi sentdex, I just want to take a moment to thank you for the amazing content. Just one thing, your commentary is a little faint (it could just be me though). Thanks again and keep up the great work :)

tejasviclaw
Автор

Clearly explained! Thanks... U type very fast. Any tips to improve my typing speed??

mamadoubah
Автор

What are the direct 2 methods to construct a tuple that has only a single item in pyton

prabhuhiremath