Mastery23 Creation and use of lists in Python

In this mastery I will explain how to create and use a list in python.

Well firs a list is use it  to store values that you can use later for other purposes.Now the syntax of this ismthat first you have to put a name to that list, It could be what ever you want,followed od “=” and in brakets  it would be the values of the your list, using different comma-separated.This values can be numbers,strings,etc, it depend of you.Also is other way to made a lists is adding elements one by one, it could be in a loop for example.

when we use a loop to add elements to the list we have to write the right syntax which is this one: Firs the name of the liste,followed of a point, followed to a statement of adding for example appened,inserte, extend, etc. each of one of this has their own propuse, and for finish in parentheses the value of the varibles that you want in the list. Some examples are the following:

primos=[2,3,5,7,11,13]

fechas=[“lunes”,27,”octubre”,1997]

here are  links with more examples and information about lists: http://www.mclibre.org/consultar/python/lecciones/python_listas.html

http://docs.python.org.ar/tutorial/2/datastructures.html

CC BY 4.0 Mastery23 Creation and use of lists in Python by Efrain Duarte is licensed under a Creative Commons Attribution 4.0 International License.

Comments are closed.