Question: Using Python 3 3. You are given the the data dictionary below. Notice that the gap data are stored as strings. Fix data by replacing

 Using Python 3 3. You are given the the data dictionary

Using Python 3

3. You are given the the data dictionary below. Notice that the gap data are stored as strings. Fix data by replacing the strings with the appropriate floats and then print the dict. You might try using a loop or a list comprehension. Edit Attachments data = {'year':[1990, 2009, 2010], 'gdp':['8.95', '12.56', '14.78']} for i in enumerate(data): data['gdp'] = float('gdp') print(data) ValueError Traceback (most recent call last) in 1 data = {'year':[1990, 2000, 2010], 'gdp':['8.95', '12.56', '14.78']} 2 for i in enumerate (data): 3 data['gdp'] = float('gdp') 4 print(data) ValueError: could not convert string to float: 'gdp

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!