wordmhg 2019-10-21
sq=lambda x:x**2def list_prime(*data): list1=[] list2=[] for i in data: list1.append(i) for i in range(len(list1)): a=0 for j in range(2,list1[i]): if list1[i]%j==0: a=1 break if a==0 and list1[i]>1: list2.append(list1[i]) return list2c=list(map(int, input("请输入一串数字(用空格分隔):").split()))print("素数有:{}".format(list_prime(*c)))list3=[]for i in list_prime(*c): list3.append(i)print("素数的平方和分别为:{}".format(list3))