Skip to content

Commit c374fba

Browse files
committed
added files
1 parent 6b789ac commit c374fba

2 files changed

Lines changed: 16 additions & 8 deletions

File tree

chapter_10/file_reader.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1-
with open('pi_digits.txt') as file_object:
2-
contents = file_object.read()
3-
print(contents)
1+
file = ('/Users/david.wells/Desktop/pythonCrashCourse/chapter_10/pi_digits.txt')
2+
3+
with open(file) as file_object:
4+
lines = file_object.readlines()
5+

chapter_10/pi_string.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
1-
filename = 'pi_million_digits.txt'
1+
filename = ('/Users/david.wells/Desktop/pythonCrashCourse/chapter_10/pi_million_digits.txt')
22

33
with open(filename) as file_object:
44
lines = file_object.readlines()
5-
5+
66
pi_string = ''
7-
for line in lines:
7+
for line in lines:
88
pi_string += line.strip()
99

10-
print(f"{pi_string[:52]}...")
11-
print(len(pi_string))
10+
# print(f"{pi_string[:52]}...")
11+
# print(len(pi_string))
12+
13+
birthday = input("Enter your birthday, in the form mmddyy: ")
14+
if birthday in pi_string:
15+
print("Your birthday appears in the first million digits of pi!")
16+
else:
17+
print("Your birthday does not appear in the first million digits of pi.")

0 commit comments

Comments
 (0)