Description
In the following lab, this is a description of the lab of “turtle blast” first we command that the window color should be in color “red”, next we conclude that the pencolor of my turtle “alex” to be colored white. And then i typed the code in the bottom, this was probably one of the hardest labs so far for this class but i figured a way how to get a solution and make it run 100% using python skills with turtle. This is the following code for Lab 2 Python 2 which is turtle blast. In the next section ill clearly state what is going on in the following code for this lab.
code
In this lab we will introduce how to program using python software 3.3.2 and with this porgram we will do a program thats called turtle blast using the file turtle to actually do the program for this lab. Now first of all we had to use coloring for the window to change it to red as stated below. We also had to change the pencolor of “alex” to white to follow labs rules, Next What we had to do is put For x in range ua “100″ this is when a program moves to the direction when you type the approximate degrees you want the “arrow” to move it will move in that direction, as you see after i tell alex to move right using new code which random.radiant we want him to move right from 0,45. Next we also want to use random.radiant for the distance that we want alex to travel forward and backward and as you see its 0,150. And after i type all this code into python it will make a screenshot or diagram of a weird looking shape that concludes the result of this lab. Fianlly we finished with the coding now below ill show you the screenshot of the lab. In this lab it was the first timr we used the import random and also import randint.randint because these were probably the two most important codes that we had to use to actually type and also run the program right as it is and with that thats how i figured out the solution to this using knowledge of python and other types of skills.
import turtle import random wn= turtle.Screen() wn.bgcolor("red") alex=turtle.Turtle() alex.pencolor("white") alex.speed(0) for x in range(100): angle = random.randint(0,45) alex.right(angle) distance1 = random.randint(0,150) alex.forward(distance1) alex.back(distance1)
Screenshot
Here is the screenshot on the following source code that i wrote for the Lab 2 Python 2 turtle blast, this is the result of the sourcecode that i typed.I used print screen to get the actual screenshot then i paste it to paint and did some arrangements to it and by seeing how it looks like thats how my program came out to be looking like. Its red because of the window change i made and also i changed the pencolor of the turtle to white and thats why you see kind of like a white to it, Besides that theres no more change and as you see this is the result of the Lab 2 Python 2 Turtle Blast.