"""Some test interpreter lines for a demo Get help or find out the type of any object by e.g. help(a) """ 5*3 1//2 1.0/2.0 a=5 b=5.0 #Lists can hold intgers, floats, strings, and *any* python objects #(including more lists - you can have lists of lists) #They can be indexed... list_a = [] list_a.append(1) list_b = [2.0] list_clist_a + list_b print(list_c) print(list_c[0]) #Tuples are useful for moving multiple variables in to or out of functions, but #are "immutable" - you can't change their contents and have to create a new tuple #to do so. tuple_a = (1, 0.5) tuple_b = ('one', 'half') tuple_c = tuple_a + tuple_b #Following doesn't work. tuple_c[0]=9 #This shows how to get tuples in and out of functions... def dummy(): return 1,2.0 myvar = dummy() dummy[0] def printtwo(a,b): print(a) print(b) two_things = (1,2.0) printtwo(*two_things) #Dictionaries are very neat ways of storing labelled un-structured data. #They are compatible with json, a common modern format for storing #structured data. dict_a = {"one":1, "two":2} dict_b = dict(three=3, four=4) dict_a.update(dict_b) dict_a['one'] #Finally... strings are like lists of characters. str_a = "Hello" str_b = "World." str_a + " " + str_b str_a += " " str_a.__add__(str_b)