Question: Complete the Python code in the cell below. The program starts with two empty lists: names and games_won. It should then iterate over the lines

Complete the Python code in the cell below. The program starts with two empty lists: names and games_won. It should then iterate over the lines list, splitting each line in turn, and then obtaining both the name of the pitcher and the corresponding games he won and adding the values to the corresponding list.

names = []

games_won = []

for line in lines:

# TO DO

# Append the name of each pitcher and the corresponding games won to the appropriate list.

Degrom NYM 7 7 1.81 24 159.0 Sale BOS 12 4 1.97 23 146.0 Snell TB 13 5 2.18 22 128.0 Scherzer WSH 15 5 2.19 25 168.2 Bauer CLE 12 6 2.22 25 166.0 Nola PHI 13 3 2.28 24 154.0 Verlander HOU 11 8 2.52 26 164.1 Kluber CLE 15 6 2.68 25 168.0 Cole HOU 10 5 2.75 24 153.2 Mikolas STL 12 3 2.85 24 151.1

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!