Change the function findPopulation to change the input and the comparison word both to lowercase. Now, it will match even if we executed findPopulation("CALIFORNIA").

Note: As the question suggests, this just requires two changes to findPopulation.


```
def findPopulation(state):
file = open(getMediaPath("state-populations.csv"),"rt")
lines = file.readlines()
file.close()
for line in lines:
parts = line.split(",")
if parts[4].lower() == state.lower():
return int(parts[5])
return -1
```

Computer Science & Information Technology

You might also like to view...

Which of the following code segments assigns the string “Great Year” to the Text property of a label named lblMessage when the value in the variable decSales is either greater than 50,000 or equal to 50,000?

a. If decSales > 50000 Then lblMessage.Text = “Great Year” End If b. If decSales >= 50000 Then lblMessage.Text = “Great Year” End If c. If decSales < 50000 Then lblMessage.Text = “Great Year” End If d. If decSales <= 50000 Then lblMessage.Text = “Great Year” End If

Computer Science & Information Technology

At design time, a PrintPreviewDialog is displayed in ________.

a) the Solution Explorer b) the component tray c) the Server Explorer d) the Properties window e) None of the above.

Computer Science & Information Technology

______________ and _____________ enable you to specify, with a single method declaration, a set of related methods, or with a single class declaration, a set of related types, respectively.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology

When importing an outline into an Impress presentation, Impress applies the ________ layout to the slides by default

A) Title, Content B) Title C) Two-column D) Title, 2 Content

Computer Science & Information Technology