这个错误是什么意思 ?"预计缩进块"Python

-6 python

我的代码如下:

    def value(one,two):
if one < two:
return two
else:
return one
Run Code Online (Sandbox Code Playgroud)

每次我尝试运行它时,都会出现以下错误:

IndentationError:预期缩进块

我尝试重写代码,但仍然没有发生任何事情.

Chr*_*son 6

Python使用(需要)缩进来识别代码中的块.例如:

def value(one,two):
    if one < two: 
        return two
    else:
        return one
Run Code Online (Sandbox Code Playgroud)

你有以下几点:

def value(one,two):
if one < two: 
return two
else:
return one
Run Code Online (Sandbox Code Playgroud)

这会产生您所看到的错误.