SlideShare una empresa de Scribd logo
1 de 4
Using a Turtle
Imagine a Turtle …
 Crawling over a huge
sheet of paper
 With a pen tied to its
tail.




You can command it.
The basics

Tells Python to use the
Turtle module

Sets up a Turtle and makes
it a Turtle Shape

Moves forward 100 pixels
Turns right by 90 degrees

Closes the graphic window
when you quit
Challenges


Draw a square:
 By repeating the same commands four times


 Using ‘For I in range(4):’ 



Draw a hexagon
Allow the user to say how many sides
the polygon should have
 Remember, use

‘myVariable = int(raw_input)’ to get a
number from the user


Get the turtle to draw your initials

Más contenido relacionado

La actualidad más candente (20)

VB.net
VB.netVB.net
VB.net
 
Python Control structures
Python Control structuresPython Control structures
Python Control structures
 
JavaScript - Chapter 9 - TypeConversion and Regular Expressions
 JavaScript - Chapter 9 - TypeConversion and Regular Expressions  JavaScript - Chapter 9 - TypeConversion and Regular Expressions
JavaScript - Chapter 9 - TypeConversion and Regular Expressions
 
Functions in python slide share
Functions in python slide shareFunctions in python slide share
Functions in python slide share
 
Python : Data Types
Python : Data TypesPython : Data Types
Python : Data Types
 
Javascript variables and datatypes
Javascript variables and datatypesJavascript variables and datatypes
Javascript variables and datatypes
 
Python dictionary
Python   dictionaryPython   dictionary
Python dictionary
 
Super keyword in java
Super keyword in javaSuper keyword in java
Super keyword in java
 
Constructor ppt
Constructor pptConstructor ppt
Constructor ppt
 
JavaScript Looping Statements
JavaScript Looping StatementsJavaScript Looping Statements
JavaScript Looping Statements
 
Python programming : Files
Python programming : FilesPython programming : Files
Python programming : Files
 
Union in C programming
Union in C programmingUnion in C programming
Union in C programming
 
Hibernate ppt
Hibernate pptHibernate ppt
Hibernate ppt
 
String in java
String in javaString in java
String in java
 
Php functions
Php functionsPhp functions
Php functions
 
Basic Java Programming
Basic Java ProgrammingBasic Java Programming
Basic Java Programming
 
Php cookies
Php cookiesPhp cookies
Php cookies
 
Java(Polymorphism)
Java(Polymorphism)Java(Polymorphism)
Java(Polymorphism)
 
Variables in python
Variables in pythonVariables in python
Variables in python
 
Data types
Data typesData types
Data types
 

Más de grahamwell

Excel =if function
Excel =if functionExcel =if function
Excel =if functiongrahamwell
 
Excel Min max-average
Excel Min max-average Excel Min max-average
Excel Min max-average grahamwell
 
What is binary and why do we use it?
What is binary and why do we use it?What is binary and why do we use it?
What is binary and why do we use it?grahamwell
 
Introduction to touch develop
Introduction to touch developIntroduction to touch develop
Introduction to touch developgrahamwell
 
Introduction to touch develop
Introduction to touch developIntroduction to touch develop
Introduction to touch developgrahamwell
 
The software story
The software storyThe software story
The software storygrahamwell
 
Database field types
Database field typesDatabase field types
Database field typesgrahamwell
 
Pascal names and types
Pascal names and typesPascal names and types
Pascal names and typesgrahamwell
 
Python part two names and types
Python part two names and typesPython part two names and types
Python part two names and typesgrahamwell
 
Abstraction - Year 9
Abstraction - Year 9Abstraction - Year 9
Abstraction - Year 9grahamwell
 
Thinking about your project
Thinking about your projectThinking about your project
Thinking about your projectgrahamwell
 
The rail fence
The rail fenceThe rail fence
The rail fencegrahamwell
 
Rsa encryption
Rsa encryptionRsa encryption
Rsa encryptiongrahamwell
 
Server side scripts
Server side scriptsServer side scripts
Server side scriptsgrahamwell
 
Revision topic 1 sensors and control
Revision topic 1 sensors and controlRevision topic 1 sensors and control
Revision topic 1 sensors and controlgrahamwell
 

Más de grahamwell (20)

Pseudocode
PseudocodePseudocode
Pseudocode
 
Excel =if function
Excel =if functionExcel =if function
Excel =if function
 
Excel Min max-average
Excel Min max-average Excel Min max-average
Excel Min max-average
 
What is binary and why do we use it?
What is binary and why do we use it?What is binary and why do we use it?
What is binary and why do we use it?
 
Introduction to touch develop
Introduction to touch developIntroduction to touch develop
Introduction to touch develop
 
Introduction to touch develop
Introduction to touch developIntroduction to touch develop
Introduction to touch develop
 
The software story
The software storyThe software story
The software story
 
Database field types
Database field typesDatabase field types
Database field types
 
Databases 101
Databases 101Databases 101
Databases 101
 
Kodu controls
Kodu controlsKodu controls
Kodu controls
 
Pascal names and types
Pascal names and typesPascal names and types
Pascal names and types
 
Python part two names and types
Python part two names and typesPython part two names and types
Python part two names and types
 
Abstraction - Year 9
Abstraction - Year 9Abstraction - Year 9
Abstraction - Year 9
 
Thinking about your project
Thinking about your projectThinking about your project
Thinking about your project
 
The rail fence
The rail fenceThe rail fence
The rail fence
 
Lesson 1
Lesson 1Lesson 1
Lesson 1
 
Rsa encryption
Rsa encryptionRsa encryption
Rsa encryption
 
Server side scripts
Server side scriptsServer side scripts
Server side scripts
 
Revision topic 1 sensors and control
Revision topic 1 sensors and controlRevision topic 1 sensors and control
Revision topic 1 sensors and control
 
Mtslesson
MtslessonMtslesson
Mtslesson
 

Turtle graphics

  • 1.
  • 2. Using a Turtle Imagine a Turtle …  Crawling over a huge sheet of paper  With a pen tied to its tail.   You can command it.
  • 3. The basics Tells Python to use the Turtle module Sets up a Turtle and makes it a Turtle Shape Moves forward 100 pixels Turns right by 90 degrees Closes the graphic window when you quit
  • 4. Challenges  Draw a square:  By repeating the same commands four times   Using ‘For I in range(4):’    Draw a hexagon Allow the user to say how many sides the polygon should have  Remember, use ‘myVariable = int(raw_input)’ to get a number from the user  Get the turtle to draw your initials