l = [1,4.5, 6, 9.0, 10, -1]

l

"""
Explanation: Lists and strings
Lists are data arrays. They can contain elements of different types (integers, floats).
An example of a list is
End of explanation
"""


l[0]

l[5]

"""
Explanation: The most basic operation on a list is extracting its elements at a given position.
For that we use the position in the list keeping in mind that the first element starts at 0.
End of explanation
"""


l[-1]

l[-3]

"""
Explanation: The indexing also works backwards using negative numbers
End of explanation
"""


l[6]

"""
Explanation: If you try to use an index beyond the list size you will get an error
End of explanation
"""


l[0] = 100

l

"""
Explanation: Lists are mutable. That means you can change the value of an item as follows
End of explanation
"""


print(l) # this is the full list

l[0:4] #start=0, end=4

l[2:4] #start=2, end=4

l[-4:-1] #start=-4, end=-1, negative values are allowed.

"""
Explanation: Slicing
Arguably, the most useful list operation is slicing.
You can use it to quickly select a subset from the list. 
Slicing consists in using two different indices separated by : to select the elements
with the syntax l[start:end]
Here are some examples. Please be sure that you understand how tthe start:end indexing works!. That's the whole point of slicing, if some of the examples are unclear, please ask!
End of explanation
"""


l[3:]

l[:4]

"""
Explanation: Slicing also works if you use only one index.
End of explanation
"""


m = [45, -56]
print('l=', l)
print('m=', m)
n = l + m
print('n=',n) # this is the concatenation

m + l #sum of lists does not commute!

2 * l # here I am reapeating the list `l` two times.

"""
Explanation: The mathematical operations + and * can also be used with lists.
The first operation is used for concatenation and the second for repetition.
End of explanation
"""


l_sorted = sorted(l)
print(l_sorted)

"""
Explanation: The function sorted can be used on lists to reorder the objects
End of explanation
"""


len(l)

"""
Explanation: and the function len gives you the number of items in the list
End of explanation
"""


given_name = "Silvia"
family_name = "Rivera Cusicanqui"

print(given_name + " " + family_name) # This is the concatenations of the strings

"""
Explanation: In python the strings are defined as a list of characters
End of explanation
"""


given_name.upper() #convert to upper case

given_name.replace('i', 'y') #replace 'i' with 'y'

given_name.count('i') # count how many times 'i' is the string

family_name.split() # split the original string in the places with spaces, the result is a new list.

"""
Explanation: These strings have many useful methods
End of explanation
"""


