There is a specific method called append() provided by lists. It is used to append an element to a list. This mutates the original list (it does not create a new list.:
listSay = ['How','Are']
print listSay # will give you ['How','Are','You']
This might remind you of the ‘+’ operator we use for joining strings, lists can use this operator too:
listGreet = ['You','Today']
hello = listSay + listGreet
print hello # will give you
# this however creates a new list and assigns it to the variable hello
Another useful procedure that we can use on lists is
len(), this counts the number of elements in a list.
print len(listSay) # will give you 2
print len(listGreet) # will give you 2 too
As you can see,
len() will not probe into nested list, it just gives a head-count of the number of first-level elements in the list.
We can also use
len() on strings, which will give us the number of characters in the string:
greet = 'hello!'
print len(greet) # will give us
The subsequent video lectures talk about CPU register, DRAM, hard drive and memory in general. I haven’t got much to cover on that so we’ll skip that, and I’ll see you at “For Loops”.