Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please show Python code with explanation! Section 1 You must use Juypter Notebooks python ) for this assignment. You will import a file Baseball _
Please show Python code with explanation!
Section
You must use Juypter Notebooks python for this assignment. You will import a file BaseballRoster.txt into a Jupyter notebook program. You can find this file in Canvas with the assignment. Make sure you copy this file into your working Jupyter Notebook folder.
The information in the file is the starting lineups for the All Star game. There is one player on each line of the file. It includes the following information separated by commas in this order:
Which league either NL for National League or AL for American League
Position of the player on the field
Name of the player
Team of the player
Jersey Number
Once you open the file, you will use the readlines command to create a list variable named BaseballRoster with the information from the import file.
Make sure you close the import file once you create the BaseballRoster variable.
Section
You will print out the roster with the following constraints.
You will print out which League title centered on the page for each of the leagues.
You will print out column headings for each column of information
You will include the National League players together and the American League player together
You will insert one blank line between the National and American League Rosters
The League column will have minimum of spaces and left justified
The Position column will have a minimum of spaces and be left justified
The Name column will have a minimum of spaces and be left justified
The Team column will have a minimum of spaces and be centered
The Number column will have a minimum of spaces and be right justified
BaseballRoster.txt
NL Pitcher, Clayton Kershaw, Los Angeles Dodgers,
NL Catcher, Willson Contreras, Chicago Clubs,
NL First Base, Paul Goldschmidt, Stl Louis Cardinals,
NL Second Base, Jeff Mc Neil, New York Mets,
NL Third Base, Manny Machado, San Diego Padres,
NL Shortstop, Trea Turner, Los Angeles Dodgers,
NL Outfield, Ronold Acuna Jr Atlanta Braves,
NL Outfield, Mookie Betts, Los Angeles Dodgers,
NL Outfield, Joc Pederson, San Francisco Giants,
NL Designated hitter, William Contretaras, Atlanta Braves,
AL Pitcher, Shane McClanahan, Tampa Bay Rays,
AL Catcher, Alejandro Kirk, Toronto Blue Jays,
AL First Base, Vladimar Guerrero Jr Toronto Blue Jays,
AL Second Base, Andres Gimenez, Cleveland Guardians,
AL Third Base, Rafael Devers, Bosten Red Sox,
AL Shortstop, Time Anderson, Chicago White Sox,
AL Outfield, Aaron Judge, New York Yankees,
AL Outfield, Byron Burxton, Minnesota Twins,
AL Outfield, Giancarlo Stanton, New York Yankees,
AL Designated hitter, Shohei Ohuani, Los Angeles Angels,
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