to choose an element from sequence at randomyou can use choicet [ random choice( random choice( the random module also provides functions to generate random values from continuous distributions including gaussianexponentialgammaand few more adding new functions so farwe have only been using the functions that come with pythonbut it is also possible to add new functions function definition specifies the name of new function and the sequence of statements that execute when the function is called once we define functionwe can reuse the function over and over throughout our program here is an exampledef print_lyrics()print(" ' lumberjackand ' okay "print(' sleep all night and work all day 'def is keyword that indicates that this is function definition the name of the function is print_lyrics the rules for function names are the same as for variable nameslettersnumbers and some punctuation marks are legalbut the first character can' be number you can' use keyword as the name of functionand you should avoid having variable and function with the same name the empty parentheses after the name indicate that this function doesn' take any arguments later we will build functions that take arguments as their inputs the first line of the function definition is called the headerthe rest is called the body the header has to end with colon and the body has to be indented by conventionthe indentation is always four spaces the body can contain any number of statements if you type function definition in interactive modethe interpreter prints ellipses to let you know that the definition isn' completedef print_lyrics()print(" ' lumberjackand ' okay "print(' sleep all night and work all day 'to end the functionyou have to enter an empty line (this is not necessary in scriptdefining function creates variable with the same name