returns file object for writingwhere the string nameinfilesystem will be the name of the file if it did not exist beforeit is created if it did exist beforeall previous contents are erased (cif infile is file opened for readingand outfile is file opened for writingthen infile read(returns the entire file contents of the file as string infile close(closes the file in the operating system (generally not neededunless the file is going to be modified laterwhile your program is still runningoutfile writestringexpression writes the string to the filewith no extra newline outfile close(closes the file in the operating system (important to make sure the whole file gets written and to allow other access to the file mutable objects [issues with mutable objects (page )care must be taken whenever second name is assigned to mutable object it is an alias for the original nameand refers to the exact same object mutating method applied to either name changes the one object referred to by both names many types of mutable object have ways to make copy that is distinct object zelle' graphical objects have the clone method copy of list may be made with full slicesomelist[:then direct mutations to one list (like appending an elementdo not affect the other listbut stilleach list is indirectly changed if common mutable element in the lists is changed graphics systematic reference to zelle' graphics packagegraphics pyis at (aintroductory examples of using graphics py are in [ graphics introduction (page )][sample graphics programs (page )]and [entry objects (page )(bwindows operating system pyw in windowsa graphical program that take no console input and generates no console outputmay be given the extension pyw to suppress the generation of console window [ windows operating system specializationpyw (page )(cevent-driven programs graphical programs are typically event-drivenmeaning the next operation done by the program can be in response to large number of possible operationsfrom the keyboard or mouse for instancewithout the program knowing which kind of event will come next for simplicitythis approach is pretty well hidden under zelle' graphics packageallowing the illusion of simpler sequential programming [graphics py vs event driven graphics (page )(dcustom computer colors are expressed in terms of the amounts of redgreenand blue [custom colors (page )(esee also animation under the summary of programming techniques additional programming techniques these techniques extend those listed in the summary (page of the previous (asophisticated operations with substrings require careful setting of variables used as an index [index variables (page ) summary