Presentation is loading. Please wait.

Presentation is loading. Please wait.

Make a function This is a starter activity and should take 5 minutes [ slide 1 ] >>> def count(number): n=1 while n <= number: print(n) n = n+1 1. Log.

Similar presentations


Presentation on theme: "Make a function This is a starter activity and should take 5 minutes [ slide 1 ] >>> def count(number): n=1 while n <= number: print(n) n = n+1 1. Log."— Presentation transcript:

1 Make a function This is a starter activity and should take 5 minutes [ slide 1 ] >>> def count(number): n=1 while n <= number: print(n) n = n+1 1. Log in to your computer 2. Open IDLE 3. In interactive mode create this function: 4. Press return untill the >>> prompt returns, then type this line: >>> count(10)

2 Lesson Aims [ slide 2 ] Vocabulary function def key word argument hacking In this lesson you are going to: 1.learn about functions 2.write your own functions 3.use your own functions

3 Interactive session [ slide 3 ] 1.Read Delving deeper on page 47 – how to stop a code that will not finish. 2.Work your way through pages 47 – 50 in Python Basics. Top Tip: Do you remember how to copy chunks of code easily in IDLE? If not, read what Mr Campbell has to say on page 50. If you have finished: 1. Help other students who may be stuck 2.Try Idea 1 on page 53. Save your file in your Python Code folder.

4 Homework 1.Play the Light-Bot game here: http://armorgames.com/play/2205/light-bot http://armorgames.com/play/2205/light-bot 2.Take a screen shot of where you got to in 30minutes and send it to your teacher. 3.Stop if you have other homeworks to do! [ slide 4 ]

5 Lesson Summary [ slide 5 ] In this lesson you have: 1.learn about functions 2.written your own functions 3.used your own functions Vocabulary You now know what a function is but what Python keyword is required? What does hacking mean? What is an argument? Information required by a function Re-writing bits of existing code to change what it does def


Download ppt "Make a function This is a starter activity and should take 5 minutes [ slide 1 ] >>> def count(number): n=1 while n <= number: print(n) n = n+1 1. Log."

Similar presentations


Ads by Google