This is my custom module:
class Player(object): def __init__(self, name, score = 0): self.name = name self.score = score def __str__(self): rep = self.name + ":\t" + str(self.score) return rep def ask_yes_no(self, question): response = None while response not in ("y", "n"): response = input(question).lower() return response def ask_number(self, question, low, high): response = None while response not in range (low, high): response = int(input(question)) return response
import games, random print "Welcome to the world's simplest game!\n" again = None while again != "n": players =  num = games.ask_number(question = "How many players? (2-5): ", low = 2, high = 5) for i in range(num): name = raw_input("Player name: ") score = random.randrange(100) +1 player = games.Player(name, score) players.append(player) print "\nHere are the game results: " for player in players: print(player) again = games.ask_yes_no("\nDo you want to play again? (y/n): ") raw_input("Press enter to exit.")
This is the error I get when I run the program:
AttributeError: 'module' object has no attribute 'ask_number'
Please help me. Thanks!