Answered step by step
Verified Expert Solution
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 readCountiesfileName:
counties
with openUScountiestxtr as file:
for line in file:
county, state line.stripsplit
counties.appendfstate: county
return counties
if namemain :
readFile UScountiestxt
counties readCountiesreadFile
counties.sort
for county in counties:
printcounty
Whenever I hit "run" it gives me this error at line : builtins.NameError: name 'UScounties 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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started