HANGMAN PYTHON.docx - HANGMAN PYTHON TURTLE(OBJ Oriented...

This preview shows page 1 - 4 out of 7 pages.

HANGMAN PYTHON & TURTLE (OBJ Oriented) from turtle import * import time def hangman(): print "Can you guess correctly before the man is hung?" t = Turtle() t.speed( 100 ) def head(): t.circle( 30 ) def body(): t.right( 90 ) t.forward( 75 ) def left_arm(): t.right( 180 ) t.forward( 50 ) t.left( 135 ) t.forward( 50 ) def right_arm(): t.right( 180 ) t.forward( 50 ) t.left( 45 ) t.right( 135 ) t.forward( 50 ) def left_leg(): t.left( 180 ) t.forward( 50 ) t.left( 135 ) t.forward( 50 ) t.right( 45 ) t.forward( 50 ) def right_leg(): t.right( 180 ) t.forward( 50 ) t.right( 135 ) t.left( 45 ) t.forward( 50 ) def eye_one():
t.right( 180 ) t.forward( 50 ) t.right( 45 ) t.forward( 75 ) t.left( 90 ) t.penup() t.forward( 15 ) t.right( 90 ) t.forward( 30 ) t.forward( 7.5 ) t.left( 90 ) t.forward( 1 ) t.right( 45 ) t.forward( 5 ) t.right( 180 ) t.pendown() t.forward( 7 ) t.penup() t.right( 45 + 90 ) t.forward( 5 ) t.right( 45 + 90 ) t.pendown() t.forward( 7 ) def eye_two(): t.right( 90 + 45 ) t.penup() t.forward( 30 + 7.5 ) t.left( 90 ) t.forward( 30 ) t.left( 90 ) t.forward( 30 ) t.forward( 7.5 ) t.left( 90 ) t.forward( 1 ) t.right( 45 ) t.forward( 5 ) t.right( 180 ) t.pendown() t.forward( 7 ) t.penup() t.right( 45 + 90 ) t.forward( 5 ) t.right( 45 + 90 ) t.pendown()
t.forward( 7 ) def mouth(): t.penup() t.right( 90 + 45 ) t.forward(

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture