The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 4 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
How do I modify this program (attached) so that it utilizes object-oriented programming to create a member object which can accept the players name, phone number, and jersey number? I’ll need to replace the list with a dictionary to help with locating objects for removal and editing.
Â
Â
players = {} a = 0 print("Welcome Coach") def mainmenu(): print("=============Main Menu=============") print("1. Display Team Roster") print("2. Add Team Member") print("3. Remove Team Member") print("4. Edit Team Member") print("9. Exit Program") a=(input("Selection>")) if a == "1": teamroster(players) if a == "2": newplayer(players) if a == "3": removeplayer(players) if a == "4": editplayer(players) def teamroster(players): print("=====TEAM ROSTER=====") for items in players: print(items) return mainmenu() def newplayer(players): newname = input("New Player Name") players [newname] = newname return mainmenu() def removeplayer(players): delname = input("Which player would you like to remove?") if delname in players: del players[delname] else: print("Player's name not found") return mainmenu() def editplayer(players): edplayer = input("Which player would you like to edit?") if edplayer in players: newname = input("What is the new name for this player?") del players[edplayer] players[newname] = newname else: print("Sorry, that player is not on the Roster!") return mainmenu() mainmenu()
Attachments: