Question

Week 10 Python programming Baseball Team Manager MENU OPTIONS 1 – Display lineup 2 – Add...

Week 10 Python programming

Baseball Team Manager

MENU OPTIONS

1 – Display lineup

2 – Add player

3 – Remove player

4 – Move player

5 – Edit player position

6 – Edit player stats

7 - Exit program

POSITIONS

C, 1B, 2B, 3B, SS, LF, CF, RF, P

Menu option: 1

POS

AB

H

AVG

Player

1

Denard Span

CF

545

174

0.319

2

Brandon Belt

1B

533

127

0.238

3

Buster Posey

C

535

176

0.329

4

Hunter Pence

RF

485

174

0.359

5

Brandon Crawford

SS

532

125

0.235

6

Eduardo Nunez

3B

477

122

0.256

7

Joe Panik

2B

475

138

0.291

8

Jarrett Parker

LF

215

58

0.270

9

Madison Bumgarner

P

103

21

0.204

Menu option: 7

Bye!

Specifications

Use the multiplication operator to make sure that horizontal separator lines use 64 characters.

Use spaces, not tabs, to align columns. This should give the program more control over how the columns are aligned.

Make sure the program always displays the batting average with 3 decimal places. Display the positions by processing the tuple of valid positions.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

def main():
    print('                    Baseball Team Manager                       ')
    print('Menu Options')
    while True:
        print('\n1 - display lineup')
        print('2 – Add player')
        print('3 – Remove player')
        print('4 – Move player')
        print('5 – Edit player position')
        print('6 – Edit player stats')
        print('7 - Exit program')
        print('Menu option: ',end = '')
        choice=input()
        if choice=='7':
            print('Bye!')
            break
        elif choice=='1':
            print('+'*64)
            print('+    Player                     + POS + AB + H +   AVG   +')
            print('+'*64)
            print('+ 1 + Denard Span               + CF   + 545 + 174 + 0.319 +')
            print('+ 2 + Brandon Belt              + 1B   + 533 + 127 + 0.238 +')
            print('+ 3 + Buster Posey              + C    + 535 + 176 + 0.329 +')
            print('+ 4 + hunter Pence              + RF   + 485 + 174 + 0.359 +')
            print('+ 5 + Brandon Crawford          + SS   + 532 + 125 + 0.235 +')
            print('+ 6 + Eduardo Nunez             + 3B   + 477 + 122 + 0.256 +')
            print('+ 7 + Joe Panik                 + 2B   + 475 + 138 + 0.291 +')
            print('+ 8 + Jarret Parker             + LF   + 215 + 58 + 0.270 +')
            print('+ 9 + Madison Bumgarner         + P    + 103 + 21 + 0.204 +')
            print('+'*64)
        else:
            print('Invalid choice')

main()

Add a comment
Know the answer?
Add Answer to:
Week 10 Python programming Baseball Team Manager MENU OPTIONS 1 – Display lineup 2 – Add...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a Python program that stores the data for each player on the team, and it...

    Write a Python program that stores the data for each player on the team, and it also lets the manager set a starting lineup for each game. Questions: - Handle the exception that occurs if the program can’t find the data file. - Handle the exceptions that occur if the user enters a string where an integer is expected. - Handle the exception that occurs if the user enters zero for the number of at bats. - Thoroughly test the...

  • Help me figure this problem out, please. Use a list to store the players Update the...

    Help me figure this problem out, please. Use a list to store the players Update the program so that it allows you to store the players for the starting lineup. This should include the player’s name, position, at bats, and hits. In addition, the program should calculate the player’s batting average from at bats and hits. Console ================================================================ Baseball Team Manager MENU OPTIONS 1 – Display lineup 2 – Add player 3 – Remove player 4 – Move player 5...

  • Something is preventing this python code from running properly. Can you please go through it and...

    Something is preventing this python code from running properly. Can you please go through it and improve it so it can work. The specifications are below the code. Thanks list1=[] list2=[] def add_player(): d={} name=input("Enter name of the player:") d["name"]=name position=input ("Enter a position:") if position in Pos: d["position"]=position at_bats=int(input("Enter AB:")) d["at_bats"] = at_bats hits= int(input("Enter H:")) d["hits"] = hits d["AVG"]= hits/at_bats list1.append(d) def display(): if len(list1)==0: print("{:15} {:8} {:8} {:8} {:8}".format("Player", "Pos", "AB", "H", "AVG")) print("ORIGINAL TEAM") for x...

  • Chapter 8 Python Case study Baseball Team Manager For this case study, you’ll use the programming...

    Chapter 8 Python Case study Baseball Team Manager For this case study, you’ll use the programming skills that you learn in Murach’s Python Programming to develop a program that helps a person manage a baseball team. This program stores the data for each player on the team, and it also lets the manager set a starting lineup for each game. After you read chapter 2, you can develop a simple program that calculates the batting average for a player. Then,...

  • Case Study Baseball Team Manager. CMSC 135 Python Chapter 7 Assignment: Use a file to save...

    Case Study Baseball Team Manager. CMSC 135 Python Chapter 7 Assignment: Use a file to save the data Update the program so it reads the player data from a file when the program starts andwrites the player data to a file anytime the data is changed What needs to be updated: Specifications Use a CSV file to store the lineup. Store the functions for writing and reading the file of players in a separate module than the rest of the...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
Active Questions
ADVERTISEMENT