句子如下。 “算术表达式由常量、变量、两者的组合或由算术运算符连接的函数调用组成”
我需要一个详细说明和一个例子,上面写着“一个函数调用,由算术运算符连接
# constants
MY_CONST = True
MAX_COUNT = 10
# variable
some_counter = 0
def my_function():
global some_counter
if MY_CONST: # algorithmic operator if
some_counter += 1 # algorithmic operator +=
else:
some_counter -= 1 # algorithmic operator -=
if abs(some_counter) == MAX_COUNT: # abs is another function, == another algorithmic operator
print('event occurred')
some_counter = 0 # algorithmic operator =
for _ in range(MAX_COUNT):
# function call
my_function()