I’m doing PLTW 1.2.4 for APCSP but I literally don’t know how the rand.randint = could possibly work??? Because it’s always going to be out of range?? And no matter what I do it throws the same error at me? I’m actually going crazy. The website told me to put in That Specific Code.
wn = trtl.Screen() maze_painter = trtl.Turtle() walls = 25 wall_length = 25 pathw = 15 color = "black" for i in range(walls): door = rand.randint(pathw*2, (wall_length - pathw*2)) barrier = rand.randint(pathw*2, (wall_length - pathw*2)) ##MOVEING maze_painter.forward(wall_length) maze_painter.left(90) ##DOOOOOOOORRRRRR maze_painter.forward(10) maze_painter.penup() maze_painter.forward(door) maze_painter.pendown() ###############BARRIer maze_painter.forward(40) maze_painter.left(90) maze_painter.forward(barrier) maze_painter.back(barrier) maze_painter.right(90) ######################### wall_length += pathw maze_painter.hideturtle() wn.mainloop()
submitted by /u/MaybeBasilThePlant
[link] [comments]
r/learnpython I’m doing PLTW 1.2.4 for APCSP but I literally don’t know how the rand.randint = could possibly work??? Because it’s always going to be out of range?? And no matter what I do it throws the same error at me? I’m actually going crazy. The website told me to put in That Specific Code. wn = trtl.Screen() maze_painter = trtl.Turtle() walls = 25 wall_length = 25 pathw = 15 color = “black” for i in range(walls): door = rand.randint(pathw*2, (wall_length – pathw*2)) barrier = rand.randint(pathw*2, (wall_length – pathw*2)) ##MOVEING maze_painter.forward(wall_length) maze_painter.left(90) ##DOOOOOOOORRRRRR maze_painter.forward(10) maze_painter.penup() maze_painter.forward(door) maze_painter.pendown() ###############BARRIer maze_painter.forward(40) maze_painter.left(90) maze_painter.forward(barrier) maze_painter.back(barrier) maze_painter.right(90) ######################### wall_length += pathw maze_painter.hideturtle() wn.mainloop() submitted by /u/MaybeBasilThePlant [link] [comments]
I’m doing PLTW 1.2.4 for APCSP but I literally don’t know how the rand.randint = could possibly work??? Because it’s always going to be out of range?? And no matter what I do it throws the same error at me? I’m actually going crazy. The website told me to put in That Specific Code.
wn = trtl.Screen() maze_painter = trtl.Turtle() walls = 25 wall_length = 25 pathw = 15 color = "black" for i in range(walls): door = rand.randint(pathw*2, (wall_length - pathw*2)) barrier = rand.randint(pathw*2, (wall_length - pathw*2)) ##MOVEING maze_painter.forward(wall_length) maze_painter.left(90) ##DOOOOOOOORRRRRR maze_painter.forward(10) maze_painter.penup() maze_painter.forward(door) maze_painter.pendown() ###############BARRIer maze_painter.forward(40) maze_painter.left(90) maze_painter.forward(barrier) maze_painter.back(barrier) maze_painter.right(90) ######################### wall_length += pathw maze_painter.hideturtle() wn.mainloop()
submitted by /u/MaybeBasilThePlant
[link] [comments]