lists tuples strings may be indexed, which selects an individual elements, e.g. s[2] selects the 3rd element of s as indexes start from 0 ie s[0] is the first element indexes may be negative which means counting from end of string/list s[-1] is the last element, s[-2] is the second from last and so on slice is the name of objects used to index one or more elements in a string or list or tuple [start : end :step] each of start end and step are optional but at least one must be present if step is not present the second : may be omitted if end is not present it is taken to be end of string s[0:] means the entire string/list/tuple note end is not repeat NOT included in the selection so s[:3] selects the first 3 elements s[0],s[1], s[2] the same start,end,step is used for the range function which is used to generate a list (in effect) of numbers, often for a for loop range(10) generates a list of 10 numbers 0,1,2,3,4,5,6,7,8,9 range(2,13,2) generates a list of even numbers 2,4,6,8,10,12 a simple for loop might be for i in range(1,11): print(i) you can build a list by creating an empty list and using a for loop to append to it even_numbers = [] # empty list for i in range(1, 11): print('i is {} and i squared is {}'.format(i, i*i)) python has a quicker, shorter syntax called list comprehension even_numbers = [i for i in range(2,13,2)] you can use an if statement which comes after the for even_numbers = [i for i in range(2,13) if (i%2) == 0] though this would be silly as you can use the previous example ___________________________________________________________ diversion you can assign different values using if else (python's version of a conditional expression) is_even = True if (value%2) == 0 else False ___________________________________________________________ different elements in a list can be of any type so a list can contain other lists, or strings, or tuples or dicts the different elements in a list don't have to be the same type, but that soon gets confusing going back to this example even_numbers = [] # empty list for i in range(1, 11): print('i is {} and i squared is {}'.format(i, i*i)) another way to get the same output is even_numbers = [(i, i*i) for i in range(2,13,2)] for el in even_numbers: print('i is {} and i squared is {}'.format(el[0], el[1])) though you could argue the list name (even_numbers) is a bit misleading finally you can have [(i,j) for i in range(1,10) for j in range(1,5)]