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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started