The line of code to create a "person1" sprite named sprite
sprite = codesters.Sprite("person1")
for counter in range(5):
pass
The line of code which tests whether the variable "choice" is equal to True
if choice == True:
The line of code that creates a string variable named var with the text as "Easy Peasy"
var = "Easy Peasy"
stage.event_mouse_move(None)
The line of code to change the size of the sprite named sprite to ".5"
sprite.set_size(.5)
The line of code which creates a loop printing each element of a list named "my_list"
for value in my_list:
print(value)
The lines of code that are used to create an if else statement comparing x to 10.
if x == 10:
//code
else:
//code
x = random.randint(0,100)
The line of code to create an empty dictionary named "my_dictionary"
my_dictionary = {}
The line of code to create a "person1" sprite named sprite on a random x and y position (-250 to 250 for each)
sprite = codesters.Sprite("person1", random.randint(-250,250), random.randint(-250,250))
The key word for ending a loop early
what is a break?
The lines of code to make an if statement for x = 10 and y = 10. If it is True, print "Both are ten" to the console
if x == 10 and y == 10:
print("Both are ten")
The line of code which creates a boolean variable "boo" with the value of False.
boo = False
What is a #?
The line of code to pause the stage for two seconds
stage.wait(2)
The line of code which creates an infinite loop (2x POINTS!!)
while True:
if x == 10:
print(x)
elif x == 5:
print(x)
else:
print(x)
The key word to use a variable created outside a loop to now use it inside the loop.
What is global?
The line of code that "catchs" a generic error and stores the error message in the variable e.
except Exception as e:
The line of code to give a sprite named sprite an attribute. Name the attribute "is_alive" and set it to True.
sprite.is_alive = True
The line of code that creates a loop that continues while my_var is equal to the string "hello"
while my_var == "hello":
The line of code which compares the boolean variables x, y, and z. x needs to be True. Of y and z, one of them need to be True. Use the expression in an "if" statement to print out "Tough Question"
if x and (y or z):
print("Tough Question")
The line of code to convert a string into a list. List name is my_list and String name is str.
my_list = list(str)
The line of code which prints a random float integer between 0 and 1
print(random.random())