Question: Create a for loop to go over each element on the data_list. if the element is a string ('str'), recast it to a float. Save

Create a for loop to go over each element on the data_list. if the element is a string ('str'), recast it to a float.
Save 'all' the numbers to a new list called "number_list". Then, print 'number_list'.
Give the coding for the following to put into python.
The first line is:
data_list=['10.5',14.2,7.9,'42']

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!