Often we create a function main() and call other functions from def display (message): here. It makes our code more organised and is easier to see how print (message) the sections of code work. def main(): display ("This is a message") display ( “This is a second message” ) main() Method 2 Pass a function a value and return a different value. Python Code What the code is doing def ask_yes_no(question): The parameter in this code is:______________ response = None within the function________________ while response not in ("y","n"): and the returned value is ______________ response = input(question) return response def main(): answer = ask_yes_no("\nPlease enter y or n: ") print ("Thanks for entering:", answer) input ("\nPress the key to exit.") main() Method 4 Python Code What the code is doing
def display (message): print (message) def main(): display ("This is a message") display ( “This is a second message” ) main() Often we create a function main() and call other functions from here. It makes our code more organised and is easier to see how the sections of code work. Method 2 Pass a function a value and return a different value. Python Code What the code is doing def ask_yes_no(question): response = None while response not in ("y","n"): response = input(question) return response def main(): answer = ask_yes_no("\nPlease enter y or n: ") print ("Thanks for entering:", answer) input ("\nPress the key to exit.") main() The parameter in this code is:______________ within the function________________ and the returned value is ______________ Method 4 Python Code What the code is doing
Python_Student_Booklet_for_Sep_2015_v6.docx