最近开始自学python,安装好python 3.8后,也装了Anaconda.
发现一个问题是:相同的程式码,在IDLE执行正常,
但有的程式就是没法在Anaconda执行??
import sys
print("请输入一个数,以判断它是否质数: ")
for line in sys.stdin:
num=int(line)
if num > 1:
for i in range(2,num):
if (num % i) == 0:
print(num,"非质数")
break
else:
print(num,"是质数")
else:
print(num,"不是质数")