Python
基础
for 循环
python
def for_loop(n: int) -> int:
"""for 循环"""
res = 0
# 循环求和 1, 2, ..., n-1, n
# python for range 为左闭右开
for i in range(1, n + 1):
res += i
return res
if __name == '__main__':
print(for_loop(100))