I would like to add a list to a string, making it look like this:
alumnos = [["Juan", "Silvia"], ["María", "Luisa"], ...]
I do not know exactly how to do it in python.
I would like to add a list to a string, making it look like this:
alumnos = [["Juan", "Silvia"], ["María", "Luisa"], ...]
I do not know exactly how to do it in python.
You can do it directly with the append
method using another list.
alumnos.append(["Otro", "Nombre"])
Simpler is declaring the list as a variable and then using print () to display it:
alumnos = [["Juan", "Silvia"], ["María", "Luisa"], ...]
print("Lista de alumnos:" + alumnos)