Which of the following programs will not cause an error when run?
import random
6, 10) random.randint(
import random
10) random.randint(
from math import sin
sin(math.pi)
import math
from math import cos
cos(math.pi)
import math
from math import cos
math.cos(math.pi)
What is the largest number that could be printed by the following program?
import math
import random
print(math.ceil(random.uniform(random.random()*10, 30)))
What is the difference between the random
module’s
randint
and randrange
functions?
As a reminder, for both of the following problems, I highly recommend trying to answer them before running the code to verify your answer.
Describe in words what the following code draws on the Turtle’s canvas:
import turtle
= turtle.Turtle()
t for i in range(30):
5)
t.forward(
t.penup()5)
t.forward( t.pendown()
After the above code is run, what is its position (in x, y
coordinates) on the canvas? You should be able to find the information
needed to answer this question in the turtle
module’s
documentation.