Question
I'm getting a following error after finish writing in Python: The error value is: name 'randint' is not defined Name not found globally. A local
I'm getting a following error after finish writing in Python:
The error value is: name 'randint' is not defined
Name not found globally.
A local or global name could not be found. You need to define the function or variable before you try to use it in any way.
Please check line 36 of C:\Users\Paul Jung\Desktop\UOP-Class\CYB130\UsingLoops.py
Here is my code:
import random
def createHouse(xPt, yPt, size):
scale = size/100
#just a square to start
addRectFilled(canvas, xPt, yPt, 100*scale, 80*scale, blue)
#the door
dX = xPt + ((100*scale) /2-15)
dY = yPt + (80*scale)
addRectFilled(canvas, dX, dY-(30*scale), 30*scale, 30*scale, green)
#the window
wX = xPt + ((100*scale) /5)
wY = yPt + (80 * scale)
addOvalFilled(canvas,wX, wY-(60 * scale), 15 * scale, 15 * scale, orange)
#the 2nd window
w2X = xPt + ((100 * scale) / 5)
w2Y = yPt + (80 * scale)
addOvalFilled(canvas, w2X + (40 * scale), w2Y - (60 * scale), 15 * scale, 15 * scale, pink)
#the roof
rX = xPt + 100 * scale
rY = yPt + 80 * scale
addArcFilled(canvas, xPt, yPt-(50 * scale), 100 * scale, 100 * scale, 0, 180, yellow)
canvas = makeEmptyPicture(1000, 800)
# Sending random numbers for the size
# so they are different sizes of squares in our grid
for row in range(4):
for col in range(6):
x = 50 - col * 150
y = 50 - row * 175
bSize = random, randint (1, 2) * 100
createHouse(x, y, bSize)
show(canvas)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started