SHARE
TWEET

Untitled

a guest Jan 11th, 2019 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Program that finds common elements in two different lists
  2.  
  3. import random
  4.  
  5. new_list1 = []
  6. new_list2 = []
  7. common_elem = []
  8. for i in range(10):
  9.     ran_int1 = random.randint(1, 20)
  10.     new_list1.append(ran_int1)
  11.     ran_int2 = random.randint(1,20)
  12.     new_list2.append(ran_int2)
  13.     if i in new_list1 and new_list2:
  14.         common_elem.append(i)
  15.  
  16.  
  17. print(new_list1)
  18. print(new_list2)
  19. print(common_elem)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top