import numpy as np
l1 = [1,2,3,4,5,6,7]
l2 = [1,12,3,"a","b",[True,None,[True,False]],[1,2,3,[1,2,3],5,6,[15,7,9,[5,6,7]]]]
# Try to find value 15 in l2
print(l2[6][6][0])
l3 = [1+1,3,[5,7,[9,8,[7,[True,99],None],6],11+12],7,9]
# List can contain expressions.
# Try to find 99 in l3
print(l3[2][2][2][1][1])
# Use list as function name. a is an element expression of label reference to address in Ram
def a():
print("hello")
l4 = [1+1,a,[3,7,[9,8,[7,[True,99],None],6],11+12],7,9]
l5 = [1+1,a(),[3,7,[9,8,[7,[True,99],None],6],11+12],7,9]
l4[1]()
print(l4[1])
print(l5[1])
# Pop and append method
# The pop() method removes the element at the specified position. Default remove the last item on the right.
print(l4.pop())
print(l4.append("hello"))
print(l4)
# Reverse
li = [1,2,3,4,5]
l6 = li[1:4] # List comprehension start from 2 to 4.
print(l6)
l6.reverse()
print(l6)
# Strings
s = 'hello'
print(s[1])
print(s[0:4])
#s[0]="H" #Error because string is immuable. It only can be replace
s = "Hello" + "world"
print(s)
s = "hello"
s = "Hello".join("world")
print(s)
s = " ".join(["hello","world"])
print(s)
s = "Hello World!"
t = s[0:7] # It will extract position of text from 0 to 6
s = t[0] + s
print(s,t)