Chap. 3 Functions Start Python IDLE (Shell) and open a new file.

Slides:



Advertisements
Similar presentations
Function in Notepad def drawSquare(myTurtle): myTurtle.forward(100) myTurtle.right(90) # side 1 myTurtle.forward(100) myTurtle.right(90) # side 2 myTurtle.forward(100)
Advertisements

SuperStar Basics Brian Bruderer. Sequence Editors Traditional sequence editors use a large grid to control when channels are turned on and off. This approach.
PYTHON TURTLE WORLD : CHAPTER 4 FROM THINK PYTHON HOW TO THINK LIKE A COMPUTER SCIENTIST.
Cosc 1P02 Week 2 Lecture slides
Fibonacci Spiral Richard Kwong MAT 385
The Pythagorean Theorem
Geometers Sketch pad. Step 1: Open Sketch pad Use this to select items Use this to draw a point Use this to draw a circle Use this to draw a line Use.
1 Loops and Branches Ch 21 and Ch18 And how you can use them to draw cool pictures!
You SHOUD HAVE.. C:\100 folder A desktop shortcut to “IDLE (Python34)”
Art 321 Lecture 7 Dr. J. Parker. Programming In order to ‘make things happen’ on a computer, you really have to program it. Programming is not hard and.
Turtle see, turtle do Lesson 1 – Welcome to LOGO.
Agent P, I have been hearing some rumours about a Python Turtle.
Hello, little turtles. Hello, little turtles! There are many modules in Python that provide very powerful feature that we can use in our own program.
MSW Logo By Awin 9s.
Chapter 1. Objectives To provide examples of computer science in the real world To provide an overview of common problem- solving strategies To introduce.
1 Building Your Own Turtle Functions For making really cool pictures!
Make a blank window This is a starter activity and should take 5 minutes [ slide 1 ] 1.Log in to your computer 2.Open IDLE 3.In script mode create a file.
TEACHER INTRUCTIONS: You will work through this activity in Normal View mode. This is represented by the in the Bottom Left Hand Corner of this page. 2.
By. Circle Draw a circle in the box Tell about its attributes: sides, angles, whether or not it’s a polygon. Add any additional information you know about.
How to link the robot and the computer (Bluetooth) How to turn on and off How to connect the adaptor Fluke card connection Sec Getting Started How.
Freehand Sketching. Draw a horizontal line about 70 mm long, and then another six lines underneath, each separated by about 10 mm.
1 Building Your Own Turtle Functions For making really cool pictures!
NCSC Sample Instructional Unit - Elementary Measurement Lesson 4
Standard form to Equation of Circle
5. Loops 1 Let’s Learn Saenthong School, January – February 2016 Teacher: Aj. Andrew Davison, CoE, PSU Hat Yai Campus
Week 3 DO NOW QUESTIONS. In this setup procedure the programmer intended to create one turtle of each color: red, green, and blue. What went wrong? to.
The Accumulator Pattern Summing: Add up (“accumulate”), e.g. 1 2 plus 2 2 plus 3 2 plus … plus Variation: Form a product (instead of sum), e.g.
Let’s Learn 3. Modules Saenthong School, January – February 2016
First of all – lets look at the window’s you are going to use. At the top you have a toolbar, with all your various tools you can use when customising.
1.To begin click: File, New, then select Design 2.Next change the view to 2D.
8. Functions 1 Let’s Learn Saenthong School, January – February 2016 Teacher: Aj. Andrew Davison, CoE, PSU Hat Yai Campus
Turtle Graphics Lesson 2 1. There are 3 homeworks to complete during the six lessons of this unit. Your teacher will let you know when a homework has.
 An angle is a corner where two lines meet.  Angles are drawn with a small part of a circle in the corner.  Angles can be measured in degrees with.
Ch. 6 Geometry Lab 6-9b Tessellations Lab 6-9b Tessellations.
Today… The for loop. Introducing the Turtle! Loops and Drawing. Winter 2016CISC101 - Prof. McLeod1.
LOGO WHAT IS IT? HOW TO USE IT AND HOW USEFUL CAN IT BE?
CompSci 4 Java 4 Apr 14, 2009 Prof. Susan Rodger.
Using Logo to explore spiral patterns. Paul Broadbent Spiral patterns This is a (1,2,3) spiral path. It repeats lines of three.
Using the Python Turtle
Computer Programming.
Foundation Level W Module 3
Introduction to Python
Week 3 DO NOW QUESTIONS.
Operations with Fractions
LOGO BY Kaotip 9S.
What you asked me to teach…
How to apply your signature
turtle module Simple graphics programming How to use it ?
7.7.4 Quadrilaterals.
Agent P, I have been hearing some rumours about a Python Turtle.
Learning to program with Logo
Frozen Graphics Lesson 3.
Algorithms and Flow Charts
Python Mr. Husch.
Gray Scale picture def pixBW(pixel): # given a pixel, change to BW
Exercise (1) What does function chai draw? def chai(size):
Module 2 Lesson 3 Over and Over Again
7. Functions Computer Programming BSc in Digital Media, PSUIC
Attribute Blocks Ring.
Extra Drawing Practice in Java Script
Section 3 Programming with Turtle Graphics
Check List Tool Kit A description of your check box can be placed here
Using Logo and Logic This presentation uses a version of Logo called StarLogo available through MIT. It can be downloaded for free and installed on your.
Python Lesson’S 1 & 2 Mr. Kalmes.
SPL Programming – While Loop Pattern
Module 2 Lesson 3 Over and Over Again
Mod 2 Lesson 2 Repeating with loops
Module 2 Lesson 3 Over and Over Again
Bell Work Title: Turtle Intro Date:
Presentation transcript:

Chap. 3 Functions Start Python IDLE (Shell) and open a new file. You had the function square(), which draws a square of side length of 100 pixels. Write instructions in the left hand side of the box corresponding the operation that you need to perform on the right. def square(): # import turtle package # create and name a turtle # advance ____ by 100 # turn _____ right by 90o # turn ___ right by 90o  

Square Function In the same file, write another function, square1(), that draws a square of side lengths 100, but in a for loop (and make it sure that you call the function to execute). Copy square2() and paste in the same file, and rename it spiral1(). In spiral1(), change the angle from 90 to 91 degree, and have the turtle draw for 100 times. A list (Chap. 4) is useful to keep several values to be reused. Copy and paste spiral1() and rename it spiral2(). Instead of .forward(), used .circle() to draw circles for 100 times. Prior to the ‘for’ loop, add the instruction, ‘colors = [“red”, “yellow’, “blue”,”green”].’ Inside the ‘for’ loop, add the instruction, ‘___.color = colors[ x %4]’ where x is the variable you use for the ‘for’ loop.

Rosette Function Copy square1() and paste in the same file, and rename it rosette1(). In resette1(), change .forward(100) function to .circle(100). You have four-circle rosette pattern. Copy rosette1() and paste in the same file, and rename it rosette2(). In resette2(), modify the program so that you draw 6 circles. Copy rosette2() and paste in the same file, and rename it rosette3(). In resette3(), modify the program so that you draw 30 circles.

Lab 0926 Modify rosette3() function so that colors of circles are changed among six colors. Email your Python program to COMP1000.201@gmail.com