why are TUPLES even a thing?
Ғылым және технология
How cool would it be to have live chat on your website?? Make it happen for free in like 5 min with 3CX: ntck.co/3cx
Python Tuples……what are they? Are they the same as Python Lists? In this video, we’re going on a journey to uncover all the deep, dark secrets of tuples.
🔥🔥Join the NetworkChuck Academy!: ntck.co/NCAcademy
🆘🆘NEED HELP?? Join the Discord Server: / discord
☕☕ NEW coffee: ntck.co/coffee
**Sponsored by 3CX
SUPPORT NETWORKCHUCK
---------------------------------------------------
➡️NetworkChuck membership: ntck.co/Premium
☕☕ COFFEE and MERCH: ntck.co/coffee
Check out my new channel: ntck.co/ncclips
🆘🆘NEED HELP?? Join the Discord Server: / discord
STUDY WITH ME on Twitch: bit.ly/nc_twitch
READY TO LEARN??
---------------------------------------------------
-Learn Python: bit.ly/3rzZjzz
-Get your CCNA: bit.ly/nc-ccna
FOLLOW ME EVERYWHERE
---------------------------------------------------
Instagram: / networkchuck
Twitter: / networkchuck
Facebook: / networkchuck
Join the Discord server: bit.ly/nc-discord
AFFILIATES & REFERRALS
---------------------------------------------------
(GEAR I USE...STUFF I RECOMMEND)
My network gear: geni.us/L6wyIUj
Amazon Affiliate Store: www.amazon.com/shop/networkchuck
Buy a Raspberry Pi: geni.us/aBeqAL
Do you want to know how I draw on the screen?? Go to ntck.co/EpicPen and use code NetworkChuck to get 20% off!!
fast and reliable unifi in the cloud: hostifi.com/?via=chuck
#python #tuples #lists
Пікірлер: 671
How cool would it be to have live chat on your website?? Make it happen for free in like 5 min with 3CX: ntck.co/3cx Python Tuples……what are they? Are they the same as Python Lists? In this video, we’re going on a journey to uncover all the deep, dark secrets of tuples. 🔥🔥Join the NetworkChuck Academy!: ntck.co/NCAcademy 🆘🆘NEED HELP?? Join the Discord Server: discord.gg/networkchuck ☕☕ NEW coffee: ntck.co/coffee **Sponsored by 3CX
@shivsadasahayate
Жыл бұрын
Please complete the CCNA course first .. Waiting for it from long time..
@powerby369live6
Жыл бұрын
How to join in NCA academy
@infinix_6586
Жыл бұрын
Please Make Video : ROUTER FIRMWARE BACKDOORING!
@benjaminlynch9958
Жыл бұрын
Comment section has gotten completely overrun by spambots. I really wish KZread would track the IP addresses, if not the MAC addresses, of offending machines and simply ban spam offenders for a week or more.
@deancc8883
Жыл бұрын
Btw it's 10 million (your loop count) 🙃
Tuples are also hashable, which means that you can use them as dictionary keys, which, by extension, means that you can do pattern matching with tuples
@TAP7a
Жыл бұрын
That’s pretty cool, I haven’t tried that before!
@Virtuous_Rogue
Жыл бұрын
It's a big part of cloud computing
@alexkatsanos8475
Жыл бұрын
Very helpful!
@moralesj2239
Жыл бұрын
The amount of studying I had to do just to understand this comment goes to show how compact and powerful a tulple is. Had to look up how hashing translates to tuples - then search what pattern matching is. Lol great stuff! Thanks for this!
@bananawarriorwootwoot
Жыл бұрын
@@Virtuous_Rogue Can you elaborate on this? Curious to learn how that works.
why did you just stop uploading lessons??? you're a good teacher ever can you please continue??
hey chuck, you can use underscores to make numbers more readable, like 1_000_000 still gets interpreted as a million by python :)
@jasonx8152
Жыл бұрын
I love underscores for readability. If @NetworkChuck had used them, he'd realize the timing script was set for 10 million and not 1 million.
@yaboy7120
Жыл бұрын
omg :) i didnt know this thank you!!
@dinithaw
Жыл бұрын
i didn't know that before, thank u
@ALCRAN2010
Жыл бұрын
What about: 1_00_0000 How does it handle?
@venuent_
Жыл бұрын
@@ALCRAN2010 just 1000000, it probably just interprets it the exact same just more readable
Hey chuck. Every other python teacher is monotone or slow very little interactively your teaching is truly awesome I hope you continue it for years to come
@Annonyme-uf4ht
7 ай бұрын
I just hope he add the function part
@underdrip7957
7 ай бұрын
I hope Im alive for the next episode
@MegBaCil
6 ай бұрын
@@underdrip7957 Same
Appreciate the shout-out as a fellow heterogeneous hacking KZreadr!
They're useful when you don't want variables to change at runtime. An example of this would be a settings file in an application.
Please keep uploading. I started watching your videos with no Linux and Python knowledge and I am at your 7th python video. I can easily write a script just like the robotbarista without even copying from you. I literally learned because of you. Thank you very much!
there is also one key difference between lists and tuples: if two tuples have the same values, they are also the same object, meaning their id is identical. this is something to be mindful of when deepcopying objects, that have tuples somewhere down the line. Happened to me once at my student assistant job
@wrdsalad
Жыл бұрын
They will only have the same id if using copy.deepcopy(): t1 = ('asdf', 'fdsa') t2 = ('asdf', 'fdsa') print(t1 is t2) # False because id(t1) != id(t2) # Now using copy import copy t2 = copy.deepcopy(t1) print(t1 is t2) # True because id(t1) == id(t2) Since they are immutable, why would you want a new object?
@infinitefretboard
Жыл бұрын
That's great to know!
@timdelaney2798
Жыл бұрын
This is not true. They will have the same hash (assuming the things in the tuple are hashable too) but, unless they were just two references to the same tuple all along, they are still distict objects with different ids.
@timdelaney2798
Жыл бұрын
It shouldn't matter if deepcopy returns the same object or not, because its immutable. Its the same with a string or an integer or other immutables. The only way this could bite you is if you use `is`. But one should only use `is` against `None`, `True` and `False` - the only true singletons in python.
@steveyuhas9278
Жыл бұрын
I'm not sure if that's correct actually. An empty tuple will be the same object(ie have the same ID) but as soon as you load data into it, it becomes it's own unique object. You can check this using the "is" Statement. () is () will be true... but (1,2) is (1,2) will be false. The "is" Statement will check that they are the same object. Since a non-empty tuple returns false whereas an empty tuple returns true, I believe that means python will only ever have one object for an empty tuple but at the point you give the tuple any values(regardless of if it's the same values) it will create new objects.
We got a video, hooray!!!
@loganki5zyw
Жыл бұрын
yeah!!!
I was just trying to learn python, and by far you are my favourite teacher yet. Please continue this course on KZread soon
A handy way to pronounce tuple correctly is to say single, double, triple, quadruple, quintuple, sextuple, septuple, octuple... n-tuple. Also, a fun bit about tuples is that they are Product types, and they're an important component to algebraic type functional languages. An example of a Sum type would be enums with payloads. Product and Sum types are also called And and Or types.
@matj12
10 ай бұрын
When they are “triple”, “quadruple” “quintuple”, should it be then “n-ple”? I see that most of the words have the Latin numeral with the last vowel changed to u and the suffix “ple”.
@SomewhatEsoteric
10 ай бұрын
@@matj12 I don't know that anyone was going for scientifically correct or correct Latin. Someone probably just said it, it was easy, close enough, and it stuck. 🤷♂️
Cool tutorial! I have been watching all the tutorials you have been making, and all I can say is keep making more!
Please continue this series! It has helped me so much!
Love this quick and fun format, don't have much time for longer videos right now. Thanks Chuck !😉
glad to see some content about python as I'm starting to learn it
I soo badly need you to teach me tkinter, i want more of your way of teaching. You are the only one that make me understand!
Hey man I started Python this Sunday and this banger is enough to get me out of the rut.
Chuck I live you man. Your channel makes my ccna and python class easier to understand
some more crucial facts about tuples 1. not only tuples, you can unpack every iterable (other tuples, lists, generators, iterators etc.) just like (zero, one) = range(2) (*lst,) = range(100) # this is a list with 100 integers in range 0-99 inclusive [*lst] = range(100) # and this is a similar list, but cleaner syntax the same way you do, when you define a function with variadic arguments: def varfunc(*args, **kwargs): return args, kwargs args variable will always be a tuple, and kwargs always a dict varfunc() -> ((), {}) varfunc(1, 2, network='chuck') -> ((1, 2), {'network': 'chuck'}) (same as you can * on the iterables, you can always ** on mappings, like for example varfunc(**{'network': 'chuck'}) -> ((), {'network': 'chuck'}) 2. mutable/immutable list is mutable, you can not only assign indexes, but also slices (which calls list.__setslice__() in the background, like lst[1:3] = range(2) and is used for implicit list reinstantiation in functools for example), you can use .append(), .pop(), .remove() and so on tuple is not able to perform those due to unchangeability mentioned in the video, and also you may notice some optimization in the background happening, like if you check ('1', '2') is ('1', '2'), it returns True ('is' keyword examines for the same memory addresses of variables). it's called interning and works due to the immutability (in the same process scope). with lists not, because they are two separate modifiable objects that can differ in time. if you want to see some interesting experiment with mutability, check out frozenlist library github.com/aio-libs/frozenlist created by the authors of aiohttp. once you call .freeze() on a special instance that behaves similarly to list, it becomes immutable and you can use it as if it was a tuple. 3. how to change tuples? you can create new tuple variables that consist of some other tuples. to "change" a tuple t = ('network',), you can create a new variable in place of the old one (overwrite it) like this: t += ('chuck',). this makes it a t = ('network', 'chuck'). you can just use the + operator to add tuples. if you want to add a list to tuple, you can include it using unpacking. for example, having a list v = ['network', 'chuck'], you can make (*v, 'is', 'cool'). this results in ('network', 'chuck', 'is', 'cool'). 4. the 'tuples are hashable' myth it's not enough to say 'tuples are hashable'. they are only hashable if their all members are hashable, too. can you hash ([],)? cheers, nice vid network chuck!
@glazedstudio302
Жыл бұрын
Thanks for explanation!
@samoylov1973
Жыл бұрын
Thanks! Very interesting! Could it be though that there's a little mistake? (*tup,) = range(100) ; type(tup) --- returns list, not tuple
I love the way you explain things. Learning to program is challenging at times. You need to spend so much time learning and practice therefore last thing anyone need is a boring tutorial. That sense of humor made everything better without wasting time. Love man. Keep it up.
Chuck I was waiting for your video today and it's here, thank you❤
Hey chuck, I'm in college for IT. I love watching your videos. Currently I am learning about the osi and the tcpip models. This is all very interesting.
You're videos are gold. Thank you for your time making these videos. They have helped on my journey, and with someone with adhd, that says a lot.
Awesome, thank you for this! I’m literally finishing up a python 🐍 class and was still a little bit fuzzy on list and tuples. However, explaining it in terms of mutable and immutable that makes sense and the speed and storage and data involved! 🙌🏽🙌🏽🙂
@ipodtouch470
Жыл бұрын
Python is great brother .let me give you a hint though, make sure you learn intro to comp sci as well. That way when you can’t use python you’ll be able to quickly learn the necessary language ;).
Thanks for the continuing the series! Looking forward to the next video!
Closed Captioning has taught me a lot about Tules, Two Pools, Two Bowls, and Tubals.
Recently, I stumbled upon your channel, and as someone who's new to learning Python, I've been searching high and low for quality videos that can help me grasp the language. Fortunately, I found your videos, and they've been incredibly helpful in simplifying Python for me. Could you please create more Python videos in the future, bro? Just good teaching and you just make it fun can you just do python lol lol
I just got an IT specialist job for the government just want to say watching your videos really kept me inspired. I only was able to obtain my A+ certification so far and was able to get an Help desk job, I worked there for about a year and then was offered an IT specialist job. I just want to say guys don't give up if you want to do IT just keep studying and try to obtain as many certs as you can. I'm currently working on my Network + certification. It took me atleast 2 years to find a help desk starter job after getting an certification but once you get your foot in the door just keep applying to the higher jobs and also just keep studying no matter how busy you are atleast try to get 2 hours of studying in a day.
nice man, I have wondered about it since long time ago, and it's all been answered with your videos. Keep up making useful tips videos.
I watched the first couple minutes and my short attention span got the better of me but the 3CX ad was the only sponsor message I’ve watched that has benefitted me, literally got that on my site in 10 mins so thank you for that bit in the beginning.
I was just thinking of this exact concept yesterday. While learning about it.
that makes sense how you would organize the lists/tuples. i usually use dictionaries to categorize, but instead i could just be using tuples! great video, as always!
I am learning Python myself and this was informative and entertaining! Thanks, NetworkChuck!
Re23re is my safety asset along with tether so i'm really glad to hear all this!! thank you very much
@CircaSriYak
Жыл бұрын
ur mom is my safety asset
I love how you explain this. So awesome! Best teacher ever! With all these real example. Nailed it.
When are we getting the next CCNA episode? I’m really looking forward to it, I’m studying for my CCNA and your videos has been really helpful. Thanks for what you do for the community Chuck.
@swallowedinthesea11
Жыл бұрын
We waited for more than half a year for Chuck to upload episode 10 of Python! CCNA can wait.
Please continue to upload more videos i learned so much from your videos, because of the way you teach
Cool quick video Chuck! Keep it up!
Subscribed. I mean, the way you delivered that content, I couldn’t forget what a tuple is if I tried.
How you wrapped up the video is awesome 😂 💯 🔥
OMG, this makes so much sense now! Thank you Chuck!
I love how you explained it!!! You answered all the 'dumb' questions that come to our mind!
This series has really helped me a lot as a beginner learning python. I really appreciate it and I hope we'll see some more python episodes.
I love your style of presenting its very fun and informative!
You have the best python course on KZread! Please finish it! I love it! I need more!
Can you please continue your python course because I have watched it all and thank you very much for teaching me. You are the best learning You tuber. I watch you every day and learn from you. I am 9 years old and love learning about computers and IT I have watched your Linux, CCNA and Bash courses Thank you very much. You're videos are motivation me a lot. Angad Singh
you explain this so clearly and in such a fun way, you are amazing!!!!!!
and a super big advantage of immutable data-types is they are thread safe & do not need any locks or care whilst accessing them.
WOW that is so simple and so handy. Great video!
Wow! Finally, a great video explanining in detail what is so special about tuples, also kudos to the guiy from StackOverflow :)
more please thank you I enjoy watching your teaching. :)
First video I see of you, and I like it!
i was eagerly waiting for this. please make more videos on python.
You are the reason I started learning python thanks so much for these videos they are really help full
Great video. One other use case for Tuples: when you have a list or collection of data that will NEVER change, it’s good practice to use a tuple to ensure you don’t accidentally add or remove any items. Think of a list containing the months of the year, or the names of WW2 generals. That’s not something that would ever change, and by using a tuple rather than a list, you’re guarding against rogue code (potentially written by someone else years later) that tries to change that unchangeable tuple you created.
Thanks auto subtitles, now I understand why we use two pools.
Just finished the NetworkChuck Python intro course. And have to say this is the best little intro to Python that I have found on KZread. Looking forward to seeing more episodes. When are they coming out?
@swallowedinthesea11
5 ай бұрын
Some day soon.
Thanks for the video. ❤
😂 I actually hear him coaching me in my head now when I’m learning on my own! Thanks! Coffee break…
Watched the whole Phython series now im ready to start coding you should definitely make a part2🎉
You should do more educational videos. Based on this video alone, you are among the best educators I've ever seen. I don't even mind the ad, you made it lovely!
LETS GO CHUCK IS RESUMING THIS SERIES (please keep resuming it is literally the most watched series of ur channel)
Hey Chuck, just recently got into Kali Linux and love watching your videos, very good teacher I want to purchase the $120 yearly program but I'm not sure if you are going to cover EVERYTHING and I mean EVERYTHING that I need to know from the ground up to start working in let's so called IT, or get a certificate early etc.. just recently purchased a ULTIMATE KALI Guide to teach me from beginner to Advanced but you know I want to keep learning, I would highly appreciate it if you replied to me on this information!, Thanks You and have a good one☺️
Honestly... You got me to like and comment with that last line. Well played!
@NetworkChuck hey man ive been loving this series, its been helping me quite a bit. i noticed u were talking about getting to for-loops and what not later, but i cant seem to find any more videos of this series where are they?
@Nixkyt
16 күн бұрын
he stoped posting python vids
Please continue i really like this series
Amazing video chuck
Hello. Will you continue this awesome series with the fors and defs and the rest ? also with an in depth explication of the return statement. it drives me nuts. where is goes. what is the caller, where, when how. it hit me like a freight train every time i think about it
man pls contiunie with this awsome series it helped me so much but now i dont really know what to do next
@imop285
3 ай бұрын
practice
you always make things easer funnyyyyyy😂
This video really made me laugh and almost return my lunch! Great content!!
Re23re actually looks awesome, i think i might even spend some of my tether on it!! thanks for the video
@sumotive77
Жыл бұрын
why are you hodling a stable coin... a shit one at that
Woohoo a Networkchuck video!
Great video! Thanks for digging deeper and not just stopping after 1:41 ;)
This was the EXACT question I asked myself when I first started looking at Python...
C# programmer here. I just used my first tuple a couple weeks ago. I found myself with a function in which I couldn't decide on the return type. I thought "What if I could return TWO variables at once? Oh, I could use a tuple!" And then a couple days later I was writing a program that calculates a bunch of fractions. I wrote a function that returns a tuple containing the numerator and denominator. Pretty nifty! It's like creating a miniature class on the spot (that doesn't have functions) and using it on the fly.
i have watched a lot of python turorials on youtube but all of them are just typical , boring and not fun to learn but your vedios are just so unique they are just so funny , interesting and never boring i am eagerly waiting for this playlist to be completed so that i as well as many other people can learn python
so happy to se the python course continue. also cant wait to see how you handle OOP
The legend is back!
I know tuples are also more memory efficient by quite a bit in some cases. If you're dealing with say streams of data and it is in a collection, you will want to use a tuple where possible as an easy way to cut on memory by at least a bit. Of course nowadays this is less a concern because memory management and sending streams of data are less of a concern than in the Python 2 days but in some cases trading out tuples for lists can be pretty useful, especially if you're trying to Cythonize your Python code since those seconds add up (such as doing expensive calculations, as with neural networks and similar projects, or need quick responses, like with fast-paced games and flight tracking/management). I know when you need Python to do the same thing many times in a day, a second here or there can really add up. Unless you're big on process efficiency, you probably can get away with using lists instead even then at least 9 out of 10 times.
@drdesten
Жыл бұрын
To be honest, if you want high performance you're not using python anyway
@Bobbias
Жыл бұрын
@@drdesten Yes, but even for cases where you can afford to use python rather than a significantly faster language, you can still drastically affect the performance of your code depending on how you write it.
I was like when did the video end. The video was sooo good . Wee need more python Chuck 🤑
The most practical use case of tuples i.m.o. is having multiple return values from a function. Something like an error code and a message, or a succes/fail boolean and some result. Etc. Very helpful, especially when used in conjunction with tuple unpacking.
Used them as a "matrix" in python when i started learning in college, helped me a lot.
You do the best tutorials ever Chuck
Hey chuck, can you please begin the intermediate and advanced python course including awesome projects, really love your teaching style.
Thanks for the great content! Keep it up. You have inspired me to be better and learn more about computing. It's benefited me tremendously.
Great Work!!
yes more of the python series please like so chuck could see
YESSS FINALLY I LOVE YOU CHUCK
I smile everytime I see Networkchuck upload😊😊
Hey Chuck, quick question. I want to get into networking as a career, but I keep hearing network admin and network engineer thrown around. What are the differences between a network admin and a network engineer, eg. responsibilities, knowledge and experience, pay, etc?
One minute in and I'm cracking up! :-D
So, this is the end? Not even saying bye to all people like me that followed you since the first video to this one. I NEED YOU TO MAKE MORE VIDEOS😭😭 I LOVE THIS SERIES. PLEASEEEEEEE like this to make him see it
Hurray 😻. Python returned ❤️. Take love from Bangladesh 🇧🇩
Python type annotations for lists and tuples now enforce the convention. list_of_ints: list[int] = [1,2,3,4,5] three_type_tuple: tuple[int, str, bool] = (1, "a", True) Think of tuples as having a well-defined structure, like the arguments to a function. While a list stores a variable number of similarly typed values.
Yooo what code editing thingy are you using for this. Looks nice.
Very good video. :)
Does the course end here or there are more videos which haven't been added to this playlist yet? Thanks!
Love the yt subtitles "why do we have two pools, because it's faster"