File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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+
Original file line number Diff line number Diff line change 1- filename = ' pi_million_digits.txt'
1+ filename = ( '/Users/david.wells/Desktop/pythonCrashCourse/chapter_10/ pi_million_digits.txt')
22
33with open (filename ) as file_object :
44 lines = file_object .readlines ()
5-
5+
66pi_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." )
You can’t perform that action at this time.
0 commit comments