18420277269 发表于 2020-6-20 19:33:53

float’和‘ str’实例之间不支持

本帖最后由 18420277269 于 2020-6-21 08:26 编辑

mport turtle
turtle.speed("fasrest")
turtle.pensize(1)
for y in range(200):
    turtle.forward(3*y)
    turtle.left(20)
    turtle.righr(175)

显示的错误:
Traceback (most recent call last):
File "D:\Python\简单画.py", line 2, in <module>
    turtle.speed("fasrest")
File "<string>", line 8, in speed
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38-32\lib\turtle.py", line 2170, in speed
    elif 0.5 < speed < 10.5:
TypeError: '<' not supported between instances of 'float' and 'str'
>>>

Twilight6 发表于 2020-6-20 19:35:52


{:10_245:}

建议发完整代码 或者 报错


xiaosi4081 发表于 2020-6-20 19:44:45

https://www.baidu.com/s?ie=UTF-8&wd=float%E2%80%99%E5%92%8C%E2%80%98%20str%E2%80%99%E5%AE%9E%E4%BE%8B%E4%B9%8B%E9%97%B4%E4%B8%8D%E6%94%AF%E6%8C%81

18420277269 发表于 2020-6-21 08:27:19

Twilight6 发表于 2020-6-20 19:35
建议发完整代码 或者 报错

完整的代码发了,报错也发,求大佬解答

Twilight6 发表于 2020-6-21 08:28:37

18420277269 发表于 2020-6-21 08:27
完整的代码发了,报错也发,求大佬解答

import turtle
turtle.speed(0)
turtle.pensize(1)
for y in range(200):
    turtle.forward(3*y)
    turtle.left(20)
    turtle.right(175)
页: [1]
查看完整版本: float’和‘ str’实例之间不支持