Guest User

Untitled

a guest
Jan 11th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  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)
Add Comment
Please, Sign In to add comment