Created
September 13, 2017 03:26
-
-
Save Cornellio/aaa5d3c748e2643821f2b906d883e250 to your computer and use it in GitHub Desktop.
Given two files that have lists of numbers in them, find the numbers that are overlapping. One file has a list of all prime numbers under 1000, and the other has a list of happy numbers up to 1000.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with open('prime_nums.txt') as f: | |
primes = f.read().splitlines() | |
with open('happy_nums.txt') as f: | |
happys = f.read().splitlines() | |
overlap = [n for n in primes if n in happys ] | |
print(overlap) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment