Python 2

Discussion in 'Programming General' started by asdasd123, Mar 12, 2012.

Python 2
  1. Unread #1 - Mar 12, 2012 at 5:39 AM
  2. asdasd123
    Joined:
    Feb 2, 2012
    Posts:
    417
    Referrals:
    0
    Sythe Gold:
    0

    asdasd123 Forum Addict

    Python 2

    Hey I posted before and now I'm absolutely stuck on a question
    Please do it all I have no idea how to do it :s

    # Join the dots
    #
    # This exercise gives you practice at both turtle graphics and
    # using lists. It is strongly recommended that you complete
    # the "Starry, starry night" exercise before attempting this
    # one.


    # THE PROBLEM
    #
    # You are required to draw 20 (or more) randomly-positioned dots
    # on the screen and then draw a line connecting them together in
    # the same order that they were drawn. Draw the dots and the
    # connecting line in different colours. NB: You cannot start
    # drawing the line until AFTER you've finished drawing all the
    # dots. This means you'll need to find a way of remembering
    # where all the dots are and the order in which they appeared.
    #
    # HINT: A list is a good way of remembering a sequence of
    # numbers!

    from turtle import *
    from random import randint
    # speed("fastest")


    # Problem-solving strategy:
    #
    # 1. Draw the screen
    # 2. Create list(s) to record the coordinates of the dots
    # 3. Draw the dots. For each one:
    # a. Choose a random position on the screen
    # b. Move to the chosen position and draw a dot
    # c. Record the position of the dot in your list(s)
    # 4. Draw the line
    # a. Change to an appropriate pen color and size
    # b. Go to the position of the first dot, without drawing
    # c. For each position recorded in the list(s), go to that
    # position, drawing as you go
    # 5. Exit gracefully by unlocking the screen
     
< Visual Basic Tutorials by Meh ^^ (Ask here if you need any help) | Python >

Users viewing this thread
1 guest


 
 
Adblock breaks this site