in [ ]you can then interact at the last prompt there are many textbooks for python the best source of information about python is the rest of this is about what is special about the code for ai tools we will only use the standard python library and matplotlib all of the exercises can be done (and should be donewithout using other librariesthe aim is for you to spend your time thinking about how to solve the problem rather than searching for pre-existing solutions pitfalls it is important to know when side effects occur often ai programs consider what would happen or what may have happened in many such caseswe don' want side effects when an agent acts in the worldside effects are appropriate in pythonyou need to be careful to understand side effects for examplethe inexpensive function to add an element to listnamely appendchanges the list in functional language like haskell or lispadding new element to listwithout changing the original listis cheap operation for example if is list containing elementsadding an extra element to the list in python (using appendis fastbut it has the side effect of changing the list to construct new list that contains the elements of plus new elementwithout changing the value of xentails copying the listor using different representation for lists in the searching codewe will use different representation for lists for this reason features of python liststuplessetsdictionaries and comprehensions we make extensive uses of liststuplessets and dictionaries (dictssee one of the nice features of python is the use of list comprehensions (and also tupleset and dictionary comprehensions(fe for in iter if condenumerates the values fe for each in iter for which cond is true the "if condpart is optionalbut the "forand "inare not optional here has to be variableiter is an iteratorwhich can generate stream of datasuch as lista seta range object (to enumerate integers between rangesor file cond version june