1 / 18

Lesson Objectives

Lesson Objectives. http://www.brainpop.co.uk Watch Username: kmeadsch Password: ict Web address Activity: write an algorithm for putting on your shoes. Python. Computer Programming in Python.

uta-jarvis
Download Presentation

Lesson Objectives

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Lesson Objectives http://www.brainpop.co.uk Watch Username: kmeadschPassword: ictWeb address Activity: write an algorithm for putting on your shoes

  2. Python Computer Programming in Python During this term you will learn the exciting programming tool called Python. This is based on programming languages like C that are used to create many popular programs that you use everyday.ObjectivesDevelop a fundamental understanding of the basic design of a programming language • Design and create a computer program • Identify key coding elements and explain their use Want Python at home? Python is free http://python.org/download/

  3. Homework During your lesson you will have used some key terms and programming language. Update the programming dictionary below. Homework is due in the next lesson unless your teacher tells you otherwise.

  4. Optional - Starter • Robot Maze – load the Excel file Write down a list of instructions that you would give to get a robot to the exit You can do this any way you would like.

  5. What’s going on • When you launch Python IDLE, you should now see the Python Shell window, with a menu like the following, though the text may be slightly different: • Look at the Python Shell. ... Choose file NEW This is the Edit Window

  6. Using shell Shell processes instructions a line at a time. Python shell starts with >>> Let’s think of this as a happy dog’s wagging tail! Python is happy to see you! Unlike a dog it will ALLWAYs follow your instructions. But like a dog it can only understand set commands, So when you type Python acts like a dog and only pays attention to COMMANDSthat it already is trained to do. Owner says “Good dog perhaps we’ll go for a walk later!” The dog hears “ blah blahblahblahblahblahblahWALK blah!

  7. Look at the Python Shell. ... In the Shell the last line should look like >>> The >>> is the prompt, telling you Idle is waiting for you to type something. Continuing on the same line enter 6+3 Be sure to end with the Enter key. After the Shell responds, you should see something like >>> 6+3 9 >>> The shell evaluates the line you entered, and prints the result. You see Python does arithmetic. At the end you see a further prompt >>> where you can enter your next line.... 

  8. Now type In idle type • >>>print ("Hello, World!“) • Press enter to see what happens >>> x=input ("What is your name?") • Press enter -What happens? • Enter some information! • Now type print(x) • Press enter -What happens?

  9. In EDITOR • There are three types of variables: • Integers – whole numbers • Floats – decimals • Strings – text & symbols Which variable in this script WON’T print out? (50) Look at this SCRIPT What does it do?

  10. Have a go! – Use the editor .Save file as:concatenateF5 to run String concatenation without '+' operator in python one = 1 two = 2 three = (one) + (two) # what does this script do? print (three) message1 = ("hello") message2= ("world") quote = (message1) + (" ") + (message2) # This script concatenates – what do you think this means? print (quote)

  11. Our first program • Open Python • Copy out the following short program • Prior learning [ you should have done BlocklyTurtle Flower] Click F5 to see what happens Video link

  12. Our first program • Open Python • Prior learning [ you should have done BlocklyMinecraft Dude] • Copy out the following short program • Link • http://www.kingsmeadspecialisms.com/ICT/VIDEO/Video_Catalogue/Catalogue_files/py_code_for_loop_using_a_variable-to-step.swf Click F5 to see what happens Video link

  13. new commands The turtle can turn any angle you wish The command are: left(x) right (x)forward(x) You put any number between 1 – 360 in the place of x the parameter x is a numeric value Color=(“y”) the perameter here is a text strringe.g blue, yellow Begin_fill() and End_fill() are primitiveCOMMANDS What do you think they do?

  14. Turtle – Using the Fill tool The following flowchart illustrates how the while loop works. http://www.kingsmeadspecialisms.com/ICT/VIDEO/Video_Catalogue/Catalogue_files/py_turtle_while_true_colour_fill_loop.swf

  15. Task Hint, to work out the angle to turn do the following calculation Angle = 360/ number of sides Programming is all about trial and error - don’t stop trying just because it doesn’t work first time! • Create a program which draws a hexagon

  16. Before we continue • Lets get into the habit of consolidating what we learn. • Fill in your Python “Programming Dictionary”

  17. Key works • Function AKA Procedure AKA Subroutine • Code • Algorithm • Iterate • Variable • Process • Bug Take this simple Quiz Read questions carefully – there are two trick questions

More Related