# -*- coding: utf-8 -*-
#author:v
def shiyiwenpapa():
    def sywmemeda(l):           #冒泡排序
        length = len(l)
        for i in range(length-1,0,-1):
            #print(i)
            for j in range(i):
                if l[j] > l[j+1]:
                    l[j],l[j+1] = l[j+1],l[j]

    def randomlist():       #生成随机数列
        import random
        list=[]
        i=0
        while i<7:
            i+=1
            list.append(random.randint(1,10))
        return list
    list1=randomlist()
    #print(list1)
    sywmemeda(list1)
    syw=list(set(list1))
    sywmemeda(syw)
    return syw

a=shiyiwenpapa()
b=shiyiwenpapa()
c=[]
for n in a:
    if n in  b:
        c.append(n)
#c=list(a.intersection(b))
print " %s与%s的交集为:%s"%(a,b,c)

 

相关文章:

  • 2022-12-23
  • 2021-08-05
  • 2021-12-25
  • 2022-01-03
  • 2022-01-17
  • 2021-10-01
  • 2021-08-08
猜你喜欢
  • 2021-08-03
  • 2022-01-25
  • 2021-06-05
  • 2021-06-12
  • 2021-06-18
  • 2021-07-26
  • 2022-01-01
相关资源
相似解决方案