Stars in a ua0002 fall2015

Info icon This preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
![stars in a row]( - 008/resources/img/turtle/starry_2.png) ![stars curved]( - 008/resources/img/turtle/starry_3.png) ### Part 3 * again, comment out your code for drawing several stars from the previous part * now, create another function called __generate_star_data__ * this function will generate a list of lists that represents star data: * the first element in the sub list will represent an x value, the second represents a y value, and the last represents size * for example, [[0, 0, 10], [200, 200, 80]] represents 2 stars, one at the origin... and a larger star on the upper right hand corner * parameters: an int that represents the number of elements in the list (the number stars / sub lists)
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
* processing: * it will randomly generate x, y, and size values, put these values into a list... * and add this three element list to the star list (the list of lists) * the bounds of the random numbers that you generate can be hard coded based on the width and height of the window * return: the list of lists representing stars * example usage below: <pre> star_data = generate_star_data(2) print(star_data) # prints out: [[-250, 121, 49], [100, 0, 20]] </pre> ### Part 4 * use the function from the previous part to generate a list of 40 stars (a list of 40 sub lists)
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern