Skip to main content

Python Lists: Beginner Python Lists Introduction and A Beginner's Experiences Learning It

 

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!

A code snippet with the python language with lists

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

Popular posts from this blog

What are Strings? A Beginner's Guide Into Programming Strings in Python

  What is the meaning of a string in coding? Introduction Hello there, coders! This was definitely one of the weirdest concepts I had to understand when I was learning to code.  It is so simple, but I spent an entire evening understand strings! It was ver y embarrassing , but at least I know now!  To hopefully regain my pride, I'm going to explain what strings are in programming as a beginner. What even are strings? Strings are data that you can print out. It's basically text. You might be confused if 9 is a string or an integer (number), but you can just change it! You can type in your code editor to turn a certain variable or a number into a string, in our case 9, by using the str() function. You can put anything in there and it will turn into something you can print out! You can't perform math on the string '9' though. My Experience Aside from the usual data types, I was a bit stumped when I reached the string functions. There were just so many string functions, ...

A Complete Overhaul of My Text-Based CYOA Game in Python!

  Everything changed. Introduction Hello there, coders! Today, I'm going to be sharing my experiences with planning and coding a text-based CYOA game in Python! The Overhaul I overhauled everything. Why? Well, it all started when I felt some doubt about my game. I felt like everything was going alright, when I took a closer look, and saw that there was no CYOA elements in it whatsoever!  The problem with it, was the fact that you chose 4 items in the beginning, and the story unfolds right in front of your eyes. There was only one single choice in the entire game. This was why I started version 2, where the player wouldn't choose any items in the beginning and make the choices inside of the haunted mansion. When I got into writing the story, I just kept overcomplicating it with souls, and arrogant mansion owners, that I just decided to scrap it completely. There was also a version 3 but I completely forgot about it. I think I scrapped it since there were just too many choices t...

My First Prototype for my Text-Based CYOA Game in Python!

  I finished it! Introduction Hello there, coders!  I'm so happy to tell you guys, that I have finished the first prototype for my first game! It took around 5 weeks to finish my game, which could've been much lower only if I had been less lazy. By the way, my school has started again, so new posts might be slower, but I will continue uploading! Bug fixing I finished making the endings quite swiftly. It was just if statements. It wasn't really that hard. The hard part came, when I realized that my old enemy, being-able-to-choose-one-choice-again-and-again came back, and I had to get back to work. I tried fixing it manually, but then I decided to kill two birds with one stone, and made a function to optimize my code! This made me go down yet another rabbit hole. Functions If you can recall, functions are basically code that executes multiple lines of code.  There are also many functions built into Python itself. Functions, to me right now, are a bit tricky, as we can put v...