Answered step by step
Verified Expert Solution
Link Copied!

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 1
You must use Juypter Notebooks python) for this assignment. You will import a file Baseball_Roster.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 Baseball_Roster with the information from the import file.
Make sure you close the import file once you create the Baseball_Roster variable.
Section 2
You will print out the roster with the following constraints.
1. You will print out which League title centered on the page for each of the leagues.
2. You will print out column headings for each column of information
3. You will include the National League players together and the American League player together
4. You will insert one blank line between the National and American League Rosters
5. The League column will have minimum of 10 spaces and left justified
6. The Position column will have a minimum of 20 spaces and be left justified
7. The Name column will have a minimum of 25 spaces and be left justified
8. The Team column will have a minimum of 25 spaces and be centered
9. The Number column will have a minimum of 10 spaces and be right justified
Baseball_Roster.txt
NL, Pitcher, Clayton Kershaw, Los Angeles Dodgers, 10
NL, Catcher, Willson Contreras, Chicago Clubs, 15
NL, First Base, Paul Goldschmidt, Stl Louis Cardinals, 4
NL, Second Base, Jeff Mc Neil, New York Mets, 37
NL, Third Base, Manny Machado, San Diego Padres, 42
NL, Shortstop, Trea Turner, Los Angeles Dodgers, 35
NL, Outfield, Ronold Acuna Jr., Atlanta Braves, 23
NL, Outfield, Mookie Betts, Los Angeles Dodgers, 15
NL, Outfield, Joc Pederson, San Francisco Giants, 17
NL, Designated hitter, William Contretaras, Atlanta Braves, 24
AL, Pitcher, Shane McClanahan, Tampa Bay Rays, 36
AL, Catcher, Alejandro Kirk, Toronto Blue Jays, 41
AL, First Base, Vladimar Guerrero Jr., Toronto Blue Jays, 31
AL, Second Base, Andres Gimenez, Cleveland Guardians, 29
AL, Third Base, Rafael Devers, Bosten Red Sox, 33
AL, Shortstop, Time Anderson, Chicago White Sox, 44
AL, Outfield, Aaron Judge, New York Yankees, 23
AL, Outfield, Byron Burxton, Minnesota Twins, 36
AL, Outfield, Giancarlo Stanton, New York Yankees, 27
AL, Designated hitter, Shohei Ohuani, Los Angeles Angels, 44
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spatial Database Systems Design Implementation And Project Management

Authors: Albert K.W. Yeung, G. Brent Hall

1st Edition

1402053932, 978-1402053931

More Books

Students also viewed these Databases questions