Jason Ray Jason Ray - 10 months ago 67
Python Question

python class import issue

I am new to python and doing some programming for school I have written code for a roster system and I am supposed to use dictionaries. I keep getting error No module named 'players_Class'
Can someone tell me what I am doing wrong

class Players:

def __init__(self, name, number, jersey):
self.__name = name
self.__number = number
self.__jersey = jersey

def setname(self, name):
self.__name = name

def setnumber(self, number):
self.__number = number

def setjersey(self, jersey):
self.__jersey = jersey

def getname(self):
return self.__name

def getnumber(self):
return self.__number

def getjersey(self):
return self.__jersey

def displayData(self):
print("Player Information ")
print("Name:", self.__name)
print("Phone Number:", self.__number)
print("Jersey Number:", self.__jersey)

import players_Class

def displayMenu():
print("1. Display Players")
print("2. Add Player")
print("3. Remove Player")
print("4. Edit Player")
print("9. Exit Program")
return int(input("Selection> "))

def printPlayers(players):
if len(players) == 0:
print("Player not in List.")

for x in players.keys():


def addplayers(players):

newName = input("Enter new Players Name: ")

newNumber = int(input("Players Phone Number: "))

newJersey = input("Players Jersey Number: ")
players[newName] = (newName, newNumber, newJersey)
return players

def removeplayers(players):
removeName = input("Enter Player Name to be removed: ")
if removeName in players:
del players[removeName]
print("Player not found in list.")
return players

def editplayers(players):

oldName = input("Enter the Name of the Player you want to edit: ")

if oldName in players:

newName = input("Enter the player new name: ")

newNumber = int(input("Players New Number: "))

newJersey = input("Players New Jersey Number: ")

players[oldName] = petClass.Pet(newName, newNumber, newJersey)


print("Player Not Found")

return players

print("Welcome to the Team Manager")

players = {}

menuSelection = displayMenu()

while menuSelection != 9:

if menuSelection == 1:


elif menuSelection == 2:

players = addplayers(players)

elif menuSelection == 3:

players = removeplayers(players)

elif menuSelection == 4:

players = editplayers(players)

menuSelection = displayMenu()

print ("Exiting Program...")

Answer Source

you have unused

import players_Class

statement in your code. just erase it!