Ask coding questions

← Back to all posts
Can anybody help me with my code?(Python)
tremoroffcial (1)

Hi there I have an error message and its is this:
Traceback (most recent call last):
File "C:\Users\jaine\OneDrive\Desktop\Python Maze", line 142, in <module>
File "C:\Users\jaine\OneDrive\Desktop\Python Maze", line 132, in setup_maze
treasures.append(Treasure(screen_x, screen_y))
File "C:\Users\jaine\AppData\Local\Programs\Python\Python37-32\lib\", line 3816, in _init

File "C:\Users\jaine\AppData\Local\Programs\Python\Python37-32\lib\", line 2545, in init
self.turtle = TurtleImage(screen, shape)
File "C:\Users\jaine\AppData\Local\Programs\Python\Python37-32\lib\", line 2488, in _init

File "C:\Users\jaine\AppData\Local\Programs\Python\Python37-32\lib\", line 2502, in _setshape
self._type = screen._shapes[shapeIndex]._type
KeyError: 240
Code Link:

PeterChaplin_Sm (0)

First error I got was:
NameError: name 'math' is not defined on line 55
So I imported math and it worked fine.

bvaccalt (0)

Ill take a look at it

Lbailey (1)

yh you did the line 6 rong and its needs a speech mark at the end of the (shapeelnedx) should look tike this ("shapeelnedx")

jwangtcsyl (4)

Well, what coding language is this?

a5rocks (785)

If you put the code on repl, we could try certain things to see if they work. But it seems that the "circle" shape doesn't exist? (on line 65)