#This is a program which illustrates a chaotic behavior.
def main():
print("This is a program which illustrates a chaotic behavior")
x = eval(input("Enter a value between 0 and 1: "))
for i in range(10):
x = 3.9 * x * (1 - x)
print(x)
的main()什么是错的程序我想写
我读经书“Python编程,约翰Zelle介绍计算机科学”和我试图禁止复制粘贴这个简单的程序。 我使用Geany IDE和写作上面的代码后,我试图编译它,但我收到以下错误:
Sorry: IndentationError: expected an indented block (chaos.py, line 5)
也许回去和阅读有关Python语法规则,特别是关于缩进位的部分。错误告诉你问题是什么。 –
我怀疑你可能会混合制表符和空格,并且*在你的编辑器中*这行看起来很好并且缩进。 Python将选项卡扩展到每个* 8列*,而您可能只将文本编辑器设置为4.不要混合使用制表符和空格,请确保将编辑器配置为使用空格来缩进(而且每次击中TAB空间将被用来代替)。 –
@MarcB:除非用户混合了制表符和空格,并且在编辑器中看不到缩进区别。 –