python_for_asl/Exercise/exercise-5.1.py
2025-08-06 02:04:35 +08:00

10 lines
334 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 我们来输出100以内的素数
def is_prime(n):
# 检查n是否是素数一个简易的办法是遍历小于n的自然数判断是否有自然数可以整除n
return False
for i in range(100):
# 遍历100以内的自然数检查他们是不是素数并输出其中的素数
result = is_prime(i)