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
Hey! So do you remember the python assignment you finished for me in Week 4? Can you make some adjustments for me this week to the code?
***Your program for keeping track of team members is coming along, but now you want to be able to include phone numbers and jersey numbers along with your team member’s name. Modify your program from week 4 so that the program utilizes object-oriented programming to create a member object which can accept the player’s name, phone number, and jersey number. You will need to replace the list with a dictionary to help in locating objects for removal and editing. Again, File Access for long-term storage is not required for this assignment.
Â
Tips:Â While dictionaries resemble lists, remember that they are not the same! It is better to use FOR loops, not WHILE loops with index values.
Your class structure does not need a full set of accessor and mutator methods getName(), setName(newName), however it they will be helpful in the next week.
Â
Â
Â
#!/usr/bin/pythondef displayTeamRoster(team):k = 0for i in team:print idisplayMenu()return;def addNewMember(member):memberList.append(member)print('Member added')print('**')displayMenu()return;def removeMember(member):try:i = memberList.index(member)del memberList[i]print('Member removed')except ValueError:print ("ERROR: Member not found")displayMenu()return;
Attachments:
-----------