Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions