《学习如何使用Minecraft编程Python》一书中的代码不起作用

问题描述

我对编程完全陌生。我有一本书,学会用minecraft编程:用Python的力量改变世界。这本书没有真正的客户支持

我正在学习逻辑运算符顺序。本书以以下代码为例:

wolves = input("Enter the number of wolves: ")
enoughWolves = wolves > 10 and wolves < 20
print("Enough wolves: " + str(enoughWolves))

我完全按照书中的描述编写了代码,但是出现了以下错误

Traceback (most recent call last):
  File "/Users/myName/Documents/wolves.py",line 3,in <module>
    enoughWolves = wolves < 20
TypeError: '<' not supported between instances of 'str' and 'int'

我不明白此错误消息的含义,也不了解为什么书中的代码不起作用。谁能帮我吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)