Guest User

Untitled

a guest
Oct 17th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. ##a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
  2. ##b = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
  3.  
  4. ##c = []
  5. ##for x in a:
  6. ## if x in b and x not in c:
  7. ## c.append(x)
  8. ##print (c)
  9. ##a,b = ra.sample(range(100), 10), ra.sample(range(100),10)
  10.  
  11. import random as ra
  12. # selecting common numbers from 30 results in each of the two random ranges without duplicates
  13. print (set([x for x in ra.sample(range(50, 200), 30) for y in ra.sample(range(40,300),30) if x==y ]))
Add Comment
Please, Sign In to add comment