Avatar

Avatar
MrsAnderson

Monday, 28 November 2016

8wb CP2 P5 901 Tues 29th November - Python - Fantastic Functions

Homestudy. Complete Homestudy Task 2 on google classroom for 6th December.


LO To understand how to use and call functions








Fantastic Functions - Teachers' slides






Starter:  Find out what a Function is  programming. Where might we use functions?


Look at the code on the board, what might this do?  How is this a function?


Copy and paste the code from below into repl.it and experiment with making mistakes to see which errors you get and correct them.


Follow the teachers slides above.


Extension tasks are slide 5 onwards.
































Rabbit Code - if needed:








def pullRabbit ():
    print ("    ,__           ")
    print ("   / /^\  ,____   ")
    print ("   \_), ^^  _, \  ")
    print ("      / @ @ \(_/  ")
    print ("  ___{_-.x.-_}__  ")
    print ("(_______________) ")
    print ("     |       |    ")
    print ("     |       |    ")
    print ("     |       |    ")
    print ("     |       |    ")
    print ("     |_______|    ")
magicWord = input("Enter the magic word: ")
if magicWord == "abracadabra":
    pullRabbit()
else:
    print("That's not the magic word!")

No comments:

Post a Comment