# Lesson 1 - Pbaumgarten

1y ago
21 Views
534.04 KB
11 Pages
Last View : 13d ago
Transcription

Python Turtle Lesson 1 Turtle Drawing We can create cool images and graphics in Python using a module called turtle - a set of ready-made functions designed for drawing shapes and lines. A turtle is like a cursor that moves around your screen, leaving a line behind it. Turtles can draw all kinds of shapes and pictures - you just need to give them the right commands. [ the academy of code]

Python Turtle Drawing a Circle Firstly, we are going to draw a simple shape (a circle) using the turtle module. Import the turtle module. import turtle Make a turtle and load it into a variable. tina turtle.Turtle() We have named the turtle Tina, however, you can give the turtle any name you want. Set the colour that the turtle will use to draw the shape. tina.color( ‘blue’ ) Set the style of the turtle with a function called shape. tina.shape( ‘turtle’ ) Set the turtle’s speed, choosing a number between 1 and 100 (100 is the fastest). tina.speed(10) Set the thickness of the line your turtle will draw. tina.pensize(4) Now, tell your turtle to draw a circle. tina.circle(60) # draws circle with radius of 60 pixels [ the academy of code]

Python Turtle Tasks: 1. Run the code above. 2. Fill the inside of the circle with a colour (same colour as the outline). tina.fillcolor( 'blue' ) tina.begin fill() tina.circle(60) tina.end fill() 3. Fill the inside of the circle with a different colour (different colour as the outline). [ the academy of code]

Python Turtle Drawing Location Sometimes we may wish to move the turtle before we start drawing something so we can draw shapes in different locations on the screen. Set up Tina the Turtle. Take the pen up off the page so Tina does not draw lines while moving to a different location. tina.penup() Tell Tina to go to a particular point on the screen by telling her the x-coordinate and the y-coordinate. tina.goto(30,-150) # x, y Note: The screen has coordinates that go from -150 to 150 in the x (horizontal) and y (vertical) directions. [ the academy of code]

Python Turtle Put the pen back down on the screen so Tina can start drawing. tina.pendown() Start drawing your shape! tina.circle(50) [ the academy of code]

Python Turtle Olympic Flag Project The Olympic Council of Ireland have asked you to draw the Olympic flag so they can use it on their new website. Use what you have learned in this lesson to write code to make Tina the Turtle draw the Olympic flag. You will find an image of this below, to help you. [ the academy of code]

Python Turtle Lesson 2 Drawing a Square We can also draw shapes other than circles. Although, they are a little bit more complicated to draw. In order to draw other shapes, Tina must draw straight lines and then turn a certain number of degrees and then repeat. We are now going to draw a square using Tina the Turtle. Set up Tina like we did in the last lesson (import module, make turtle, set color, set speed etc.). Now, tell Tina where to draw. tina.forward(50) # go right 50 pixels tina.right(90) # turn right 90 degrees tina.forward(50) # go down 50 pixels tina.right(90) # turn right 90 degrees tina.forward(50) # go left 50 pixels tina.right(90) # turn right 90 degrees tina.forward(50) # go up 50 pixels Tasks: 1. Run the code above. 2. Fill the square with a colour. [ the academy of code]

Python Turtle Drawing Other Shapes In order to draw any shape, we must know three things: How many lines there are. How long each line will be. The angle that Tina must turn after each line has been drawn. The only one from that list that may be difficult to know is the last one. So here’s a guide to help you calculate the angle that Tina must turn to draw the shape that you want! To calculate the amount of degrees you must turn to draw a certain shape, use the following formula: Number of degrees 360 Number of sides in shape Let’s take a triangle for example. A triangle is a three-sided shape. So let’s fill that into our formula. Number of degrees 360 3 120 Hint : use a calculator to do the maths if you can’t do it in your head! So the code to draw a triangle would look something like this: tina.forward(50) tina.right(120) tina.forward(50) tina.right(120) tina.forward(50) Tasks: 1. Write code to make Tina draw a pentagon (5 sides) 2. Write code to make Tina draw an octagon (8 sides) [ the academy of code]

Python Turtle Fat Tony’s Pizzeria Project Fat Tony, a sweaty, overweight, middle-aged pizzeria owner wants you to come up with a new pizza recipe to lure in new customers. Use what you have learned in this lesson to write code to make Tina the Turtle draw a delicious new pizza design with your own favourite toppings. Hint: Once you have drawn the outer crust and base of the pizza, draw different shapes with different colours to draw your different toppings. [ the academy of code]

Python Turtle Lesson 3 Writing with Turtles Other than drawing lines and shapes, Tina the Turtle can also write words and sentences onto the canvas. We are now going to write something onto the canvas using Tina the Turtle. Set up Tina the Turtle (import module, make turtle, set color, set speed etc.). Tell Tina what to write on the canvas. tina.write( 'Hello World!' ) You can change the font and font size of what Tina is writing. tina.write( 'Hello World!' , font ( 'Arial' , 12, ' normal' )) Tasks: 1. Run the code above. 2. Change the color of the font. 3. Change the font size. [ the academy of code]

Python Turtle The Academy Of Code Poster Project The silly folks at The Academy Of Code headquarters are having trouble coming up with a new poster design for a campaign they are running to get more kids into coding (especially Python!). They want you to use everything you have learned up to know (drawing shapes, colouring shapes, writing words and sentences etc.) to design the poster that will be used in their new campaign. The best poster in the class will be featured on The Academy Of Code website! [ the academy of code]

Make a turtle and load it into a variable. tina turtle.Turtle() We have named the turtle Tina, however, you can give the turtle any name you want. Set the colour that the turtle will use to draw the shape. tina.color( ' blue' ) Set the style of the turtle with a function called shape. tina.shape( ' turtle' )

Related Documents:

4 Step Phonics Quiz Scores Step 1 Step 2 Step 3 Step 4 Lesson 1 Lesson 2 Lesson 3 Lesson 4 Lesson 5 Lesson 6 Lesson 7 Lesson 8 Lesson 9 Lesson 10 Lesson 11 Lesson 12 Lesson 13 Lesson 14 Lesson 15 . Zoo zoo Zoo zoo Yoyo yoyo Yoyo yoyo You you You you

Participant's Workbook Financial Management for Managers Institute of Child Nutrition iii Table of Contents Introduction Intro—1 Lesson 1: Financial Management Lesson 1—1 Lesson 2: Production Records Lesson 2—1 Lesson 3: Forecasting Lesson 3—1 Lesson 4: Menu Item Costs Lesson 4—1 Lesson 5: Product Screening Lesson 5—1 Lesson 6: Inventory Control Lesson 6—1

Lesson 41 Day 1 - Draft LESSON 42 - DESCRIPTIVE PARAGRAPH Lesson 42 Day 1 - Revise Lesson 42 Day 1 - Final Draft Lesson 42 - Extra Practice LESSON 43 - EXPOSITORY PARAGRAPH Lesson 43 Day 1 - Brainstorm Lesson 43 Day 1 - Organize Lesson 43 Day 1 - Draft LESSON 44 - EXPOSITORY PARAGRAPH Lesson 44 Day 1 - Revise

iii UNIT 1 Lesson 1 I’m studying in California. 1 Lesson 2 Do you have anything to declare? 5 Lesson 3 From One Culture to Another 8 UNIT 2 Lesson 1 You changed, didn’t you? 13 Lesson 2 Do you remember . . . ? 17 Lesson 3 Women’s Work 20 UNIT 3 Lesson 1 We could have an international fall festival! 25 Lesson 2 You are cordially invited. 29 Lesson 3 Fall Foods 32 UNIT 4 Lesson 1 Excuses .

For Children 4-7 Years Old Series 6 Old Testament: Genesis From Creation to the Patriarchs Lesson 1 Creation Lesson 2 Adam and Eve Lesson 3 Cain and Abel Lesson 4 Noah and the Ark Lesson 5 Abraham’s Call Lesson 6 Isaac – The Son of Promise Lesson 7 Isaac and Rebekah Lesson 8 Jacob and Esau Lesson 9 Jacob Marries Rachel Lesson 10 Jacob is .

Contents Preface 4 Lesson 1 What Is Wisdom? 14 Lesson 2 Wisdom and Foolishness 27 Lesson 3 The Example of Wise Men 40 Lesson 4 Our Home Life 55 Lesson 5 Honoring Our Parents 71 Lesson 6 Freedom and Responsibility 85 Lesson 7 How Attitudes Affect Actions 102 Lesson 8 Right Attitudes About Myself 117 Lesson 9 Good Friends and Bad Friends 130 Lesson 10 Choosing the Right Friends 140

Lesson Plan). The lesson plan (sometimes also called lesson note) is included both Type A and Type B. The format of the lesson plan is the same as the standard lesson plan that Ghana Education Service (GES) provides. The sample lesson plans of Type A also contain “lesson plan with teaching hints” on the next page of the standard lesson plan.

Joining Tables Together 196 Using Logical Operators 198 MySQL Functions 199 Accessing MySQL via phpMyAdmin 199 Windows Users 199 OS X Users 201 Linux Users 201