包含括号的表达式出现错误
I got an error for the expression containing parenthesis
print((4 + 2) / (4 % 2))
错误:
Traceback (most recent call last):
File "main.py", line 2, in <module>
print((4 + 2) / (4 % 2))
ZeroDivisionError: division by zero
您正在尝试评估 (4 + 2) / (4 % 2)
。那么(4 + 2)
就是6
,(4 % 2)
就是0
。因此,您正在评估 6 / 0
,这会产生 division-by-zero 错误。
print((4 + 2) / (4 % 2))
错误:
Traceback (most recent call last):
File "main.py", line 2, in <module>
print((4 + 2) / (4 % 2))
ZeroDivisionError: division by zero
您正在尝试评估 (4 + 2) / (4 % 2)
。那么(4 + 2)
就是6
,(4 % 2)
就是0
。因此,您正在评估 6 / 0
,这会产生 division-by-zero 错误。