- Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathq43.py
21 lines (16 loc) · 629 Bytes
/
q43.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# Given two .txt files that have lists of numbers in them,
# find the numbers that are overlapping. One .txt file has a
# list of all prime numbers under 1000, and the other .txt file
# has a list of happy numbers up to 1000.
deffiletolistofints(filename):
list_to_return= []
withopen(filename) asf:
line=f.readline()
whileline:
list_to_return.append(int(line))
line=f.readline()
returnlist_to_return
file1=filetolistofints('Day12\\one.txt')
file2=filetolistofints('Day12\\two.txt')
overlaplist= [elemforeleminfile1ifeleminfile2]
print(overlaplist)