Skip to content

Instantly share code, notes, and snippets.

#Draw A Game Board
def make_board(num = 3):
for i in range(num):
print " ---" * num
print "| " * (num + 1)
print " ---" * num
if __name__ == "__main__":
num = int(raw_input())
make_board(num)
@ProjectJYL
ProjectJYL / file_overlap.py
Created December 5, 2016 22:53
Exercise: 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. (If you forgot, prime numbers are numbers that can’t be divided by any other number. And yes, happy numbers are a real …
#File Overlap
f1 = open("Documents\primenumbers.txt", "r")
f2 = open("Documents\happynumbers.txt", "r")
f2_list = f2.readlines()
result = list()
for line in f1:
if line in f2_list:
result.append(line.strip() )