#/usr/bin/env python this is not technically part of the program it is there to tell the operating system what version of python to choosesince the older python is incompatible with the newer python we will mostly run programs from inside the idle programming environmentwhere this line is not needed to run just by clicking on the program in an operating system windowhoweverthe line is important if your computer also has python ''string substitution for mad lib adapted from code by kirby urner '' - there is multi-line text enclosed in triple quotes quoted text is called string string at the very beginning of program like this is documentation for the file , , , blank lines are included for human readability to separate logical parts the computer ignores the blank lines storyformat ''once upon timedeep in an ancient junglethere lived {animalthis {animalliked to eat {food}but the jungle had very little {foodto offer one dayan explorer found the {animaland discovered it liked {foodthe explorer took the {animalback to {city}where it could eat as much {foodas it wanted howeverthe {animalbecame homesickso the explorer brought it back to the jungleleaving large supply of {foodthe end '' the equal sign tells the computer that this is an assignment statement the computer will now associate the value of the expression between the triple quotesa multi-line stringwith the name on the leftstoryformat - these lines contain the body of the string and the ending triple quotes this storyformat string contains some special symbols making it format stringunlike the string in lines - the storyformat string will be used later to provide format into which substitutions are made the parts of the string enclosed in braces are places substitute string will be inserted later the substituted string will come from custom dictionary that will contain the user' definitions of these words the words in the braces{animal}{food}{city}indicate that animalfoodand city are words in dictionary this custom dictionary will be created in the program and contain the user' definitions of these words these user' definitions will be substituted later in the format string where each is currently def tellstory()userpicks dict(addpick('animal'userpicksaddpick('food'userpicksaddpick('city'userpicksstory storyformat format(**userpicksprint(story def is short for definition of function this line is the heading of definitionwhich makes the name tellstory becomes defined as short way to refer to the sequence of statements that start indented on line and continue through line the equal sign tells the computer that this is another assignment statement the computer will now associate the beginning with python