Question: *Python* Create a function called storeDataInDB that will use the baseball database and store all the data in list provided to the function as an
*Python*
Create a function called storeDataInDB that will use the baseball database and store all the data in list provided to the function as an input parameter into the table called players. After the data from the list has been stored in the database it should be removed from the List.
If the list contained the following:
[[1980,"Adams","Glenn","AL",262,32,75,.286], [1980,"Aikens","Willie","AL",543,70,151,.278], [1980,"Ainge","Danny","AL",111,11,27,.243]]
Then after calling storeDataInDB the table players should look like:
| year | last | first | league | atbats | runs | hits | average |
| 1980 | "Adams" | "Glenn" | "AL" | 262 | 32 | 75 | 0.286 |
| 1980 | "Aikens" | "Willlie" | "AL" | 543 | 70 | 151 | 0.278 |
| 1980 | "Ainge" | "Danny" | "AL" | 111 | 11 | 27 | 0.243 |
And the list should be empty.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
