Int, string, function, and list as list element : List Element « List « Python






Int, string, function, and list as list element

Int, string, function, and list as list element


foo = [42, 'www.java2s.com', lambda x: x**2, [47, '11']]

print foo


print foo[3]


print foo[2](3)

foo[3][0] = 99
print foo


for i in foo:
     print i, "--", type(i)


           
       








Related examples in the same category

1.Class inside a ListClass inside a List
2.List items need not all have the same type.List items need not all have the same type.
3.lambda function as a list numberlambda function as a list number