python - 这个简单的If语句向我发送了SyntaxError : invalid syntax on Python 3.6

标签 python python-3.x if-statement error-handling

elephant_weight = 3000
ant_weight = 0.1

If elephant_weight > ant_weight:
 square()

我得到的错误是:
 File "c:/Users/AIRWEBDEV/Documents/exercice.py", line 37
    If elephant_weight > ant_weight:
                     ^
SyntaxError: invalid syntax

最佳答案

正确的语法是(注意小写的if):

if elephant_weight > ant_weight:
    square()

关于python - 这个简单的If语句向我发送了SyntaxError : invalid syntax on Python 3.6,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59791994/

相关文章:

Python Sqlalchemy mysql "Cannot add or update a child row: a foreign key constraint fails"

python - 奇特的数组索引到每行的不同列索引

python - 如何将一系列数字插入sqlite3

string - Bash:将字符串作为整数进行比较

python - tensorflow:如何使用不同的条件语句设置张量的形状?

python - 使用 DataNitro 连接 3 列(可能组合的总数)

Python 字典值的部分和

arrays - 使用 np.savetxt 保存包含字符串和 float 的结构化 numpy 数组

python - 如何打印显示 4 位小数的整数?

javascript - 在 IF 函数中使用 OR 运算符时,比较条件的顺序是否重要?