Apparently, we're doing data structures here!
Introduction
Hello there, coders! Today, we're talking about lists! I'm also going to be recalling my experience learning about lists after so many minutes.
I was actually supposed to post this much earlier but because of the light cutouts coupled with my english tuition, AND my headphones not working, I couldn't start this blog post. Thankfully my lights came on a bit earlier than usual!
What are Lists?
They're a, well, list! It's very well named. It's stored in a variable with square brackets [] and separated by commas, and you can put many data types in it!
This basically just makes it a better way of storing data, instead of using normal brackets to store only one data type.
What can we do with lists?
You can modify lists even after they were made, or in other words, mutable.
You can use many functions to add data to the back of the list, remove data, add data in the middle of the list, and you can sort them by alphabetical order.
By the way, data in a list is also indexed like a string, so the first data is 0, second is 1, and so on.
You can couple this with the fact that you can slice lists by each data, so you can basically do so many useful things like slicing emails off of mbox files, or putting music or pictures in a album.
My Experiences
Learning lists were so fun! It was like learning strings but much more enjoyable because I knew what I could expect!
It also felt amazing knowing that I was learning something I could use in the real world that was actually useful.
Like, sure, mbox files are not used anymore (to my knowledge), but it's fun to know that someone used to do this for a purpose, you know?
Conclusion
Today, we learned a bit about lists and talked about its uses in the real world! I hope you found this blog a bit entertaining or even useful!
By the way, I found this website called https://www.w3schools.com/python/ which was extremely helpful for finding out the little functions that slipped out of my mind.
I highly recommend this website for trying to see if you want to see if you have to use def for making a function or not.
I'm so excited that we're finally learning about something that's different from algorithms!
Code Snippet!
This one was about extracting the emails of the people who sent us the email from an mbox file.
I decided not to add comments to explain to you guys what each code does is for y'all to test yourself what each line does.
Here's a small little challenge for you guys. Tell me what each line of code does! No pressure though. Good Luck!
and with that,
signing off,
Stewie
Comments
Post a Comment