#!/usr/bin/python3
#=====================================================================================
# Python list (A list is an array in most languages) 
#=====================================================================================
print("Content-Type: text/html \n")     #http header with newline char (required for web)

stuff1 = []                                                 #create an empty list
stuff2 = [1,2,3,4,5,6,7,8,9]
stuff3 = ['Sam','John','Steve', 1, 2, 3]                    #list elements can be multiple data types

print('<pre>')                                  #to print better on the web

print('Printing empty stuff1 list :', stuff1)
print()

print('Printing the entire stuff2 list .........:', stuff2)
print('Printing the first 2 elements of stuff2..:', stuff2[0], 'and', stuff2[1])
print('Printing the first 2 elements of stuff2..:', stuff2[0:2] )
print('Printing the number of elements in stuff2:', len(stuff2) )
print()

print('Printing the entire stuff3 list :', stuff3)
stuff3[0] = 'Samuel'                                                #change value of element
stuff3.append(4)                                                    #add new element to end of list
stuff3.append('Bill')                                               #add another element to end of list
stuff3.insert(3,'Jack')                                             #insert a new element at index 3
del stuff3[2]                                                       #delete 3rd element
print('After add, change and delete .. :', stuff3)
print()