Question: 1. Given the file census data.txt: Line 1 ILocation 2000 2011 Line 2 INew York State 18,976,811 19,378,102 Line 3 INew York City 8,008,686 8,175,133
1. Given the file census data.txt: Line 1 ILocation 2000 2011 Line 2 INew York State 18,976,811 19,378,102 Line 3 INew York City 8,008,686 8,175,133 Line 4 l What is the output of the following code? (Note: the line numbers and the "" are not actually in the file, they are just there to show that the contents is 4 lines.) f = open("cen sus-data.txt.') line1 f.readline () linel linel.strip) line2 = f.read() line3 f.readline () print (line1) print (line2) print (line3) f.close(O f open("census data.txt") s f.read() line_list = s.split(' .) print (len(line list)) line-list s. strip(), split('in') print(len(line_list))
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
