1.如何看python提示的错误信息
2.这段代码哪里出错了。
谢谢~
报的错误是
raceback (most recent call last):
File "/Users/sharonxiao/Documents/howtodraw.py", line 26, in
draw_square()
File "/Users/sharonxiao/Documents/howtodraw.py", line 22, in draw_square
lara.circle("100")
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk/turtle.py", line 1892, in circle
steps = 1+int(min(11+abs(radius)/6.0, 59.0)*frac)
TypeError: bad operand type for abs(): 'str'
源码是
import turtle
def draw_square():
window=turtle.Screen()
window.bgcolor("white")
sharon= turtle.Turtle()
sharon.shape("circle")
sharon.color("green")
sharon.speed("2")
sharon.forward(200)
sharon.right(90)
sharon.forward(200)
sharon.right(90)
sharon.forward(200)
sharon.right(90)
sharon.forward(200)
lara=turtle.Turtle()
lara.shape("turtle")
lara.color("yellow")
lara.circle("100")
window.exitonclick()