List/Tuples

--Originally published at Programming

Introduction

Don’t worry. This topic is not going to be as hard and abstract as the last one, today we are going to go back to something simple. We are going to learn about variables! But not like the normal kind of variables… Let’s get started. A variable is a reserved space of memory that stores information, which can be changed at any time. If you want to store a long list of information that doesn’t change over time or a long list of information that changes over time. How can you do it? Well here are the answers to your problems:

Lists

Just like its name, it contains a list of elements. Each one of the elements is numbered (has an index), starting from zero. You are allowed to remove items and add values to the list by using their position index on the list. Basically lists are one of the most important concepts in Python that you’ll be using a lot. Think of it as a variable on steroids.

1.png

Tuples

Tuples are just like lists, the only difference is that you can’t change their values. The values that you give the tuple the first time are the values the tuple is going to have for the rest of the program’s life. Just like the list, each value is numbered starting from 0. Unlike lists, the tuples must have parentheses surrounding their values instead of brackets. 2.png

*Note: The list examples were taken from a YouTube video https://youtu.be/1yUn-ydsgKk?list=PL6gx4Cwl9DGAcbMi1sH6oAMk4JHw91mC_ You should check out his channel.