Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For starters, I followed the directions above, and here's my code version of it: def readCounties ( fileName ) : counties = [ ] with

For starters, I followed the directions above, and here's my code version of it:
def readCounties(fileName):
counties =[]
with open(UScounties2.txt,"r") as file:
for line in file:
county, state = line.strip().split(",")
counties.append(f"{state}: {county}")
return counties
if __name__=="__main__" :
readFile = UScounties2.txt
counties = readCounties(readFile)
counties.sort()
for county in counties:
print(county)
Whenever I hit "run" it gives me this error at line 11: builtins.NameError: name 'UScounties2' is not defined"
I thought it was defined? How is it not defined? How can this be fixed?

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_2

Step: 3

blur-text-image_3

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

Databases And Information Systems 1 International Baltic Conference Dbandis 2020 Tallinn Estonia June 19 2020 Proceedings

Authors: Tarmo Robal ,Hele-Mai Haav ,Jaan Penjam ,Raimundas Matulevicius

1st Edition

303057671X, 978-3030576714

Students also viewed these Databases questions

Question

Express Pascals lond laaw, and give a real-world example of it.

Answered: 1 week ago

Question

a neglect of quality in relationship to international competitors;

Answered: 1 week ago