Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Program that finds common elements in two different lists
- import random
- new_list1 = []
- new_list2 = []
- common_elem = []
- for i in range(10):
- ran_int1 = random.randint(1, 20)
- new_list1.append(ran_int1)
- ran_int2 = random.randint(1,20)
- new_list2.append(ran_int2)
- if i in new_list1 and new_list2:
- common_elem.append(i)
- print(new_list1)
- print(new_list2)
- print(common_elem)
Add Comment
Please, Sign In to add comment