Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I am getting error in line 20, ValueError: too many values to unpack (expected 2). How to fix it? 9 filenameinput( Enter the fiLename ')

image text in transcribed I am getting error in line 20, "ValueError: too many values to unpack (expected 2)". How to fix it?

9 filenameinput( Enter the fiLename ') 10 # open file in read mode 11 rawdopen(filename, 'r') 12# read the content of file into content 13 contentrawd. read () 14# create an empty dictionary 15 dict - 16 # read file line by line 17 18 for line in content.split('In'): 19 20 country, incomeline.split() 21 # split using word as delimeter # store the key, value pair in dict dict [country]float (income) input (' Enter the country name : ') 23 country 24# keys() return the list of keys 25# if the entered country name is not present in dict 26 if country not in dict.keys (): 27 28 else: 29 print( 'No such country data available. ') print('Income', dict[ [country])

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

Fundamentals Of Database Management Systems

Authors: Mark L. Gillenson

3rd Edition

978-1119907466

More Books

Students also viewed these Databases questions

Question

How to reverse a Armstrong number by using double linked list ?

Answered: 1 week ago

Question

6. Explain how to train managers to coach employees.

Answered: 1 week ago