IDEAS ON THIS TOPIC
In the image you can see i am starting with a list with three element, but if you look at the output its outputting 4, this is because i am using insert, when you use insert you need to define where you want the element to go and then the value to be placed in there, its a very simple concept to do and understand.
Next is count, this is as you would think, so in the () you enter a value that is in the list and it will output the count of all values, it wont add the elements, it just counts so you can see how many are there. Lastly we have clear which is self explanatory, it just clears the list
In todays image we can see that i am using two new keywords, remove and pop.
The best way to think about it is that pop "pop()" removes the last element from the list, or you could put a index value, so in this case in the image i have put 1, this is the second element because python starts with 0. Next we have remove and this wants to know the value you want to remove, so in this case i entered a string, and it removed it from the list.
If you was to put "name = user.remove("sam")" it would take out the value from the list and put into the variable to be used later.
So last time was about lists, and how to add elements to the list manually, but now lets look at adding a user but the user enters the info.
I have made a empty list, in this case i have done it very simply and asked the user and put that into a variable.
Once this is done then to add it to the list all we need to do is reference the list so in this case "user" and then followed by a full stop, from here you should see a list of different functions you could use, but in this case we are looking at the "Append". This will add the data in the variable to the list. print the list a have a look
❤️ Brainstash Inc.