Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8423381
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T03:42:32+00:00 2026-06-10T03:42:32+00:00

I have been working on Python The Hard Way and am getting the above

  • 0

I have been working on Python The Hard Way and am getting the above error and have no clue why. I took out most of the filler text that I thought I could. Sorry if it is a little long.

from sys import exit
from random import randint

class Game(object):

    def __int__(self, start):
        self.quips = [
             "You died. You kinda suck at this.",
             "Your mom would be proud. If shw were smarter.",
             "Suck a loser.",
             "I have a small puppy that's better at this."
        ]
        self.start = start

    def play(self):
        next_room_name = self.start

        while True:
            print "\n-------"
            room = getattr(self, next_room_name)
            next_room_name = room()

    def death(self):
            print self.quips[randint(0, len(self.quips)-1)]
            exit(1)

    def central_corridor(self):
        print "The Gothons of Planet Percal #25 have invaded your ship and destroyed"


        action = raw_input("> ")

        if action == "shoot!":
            print "Quick on the draw you yank out your blaster and fire it at the Gothon."
            return 'death'

        elif action == "dodge!":

            print "Like a world class boxer you dodge, weave, slip and slide right"
            return 'death'

        elif action == "tell a joke":

            print "Lucky for you they made you learn Gothon insults in the academy."
            return 'laser_weapon_armory'

        else:
            print "DOES NOT COMPUTE!"
            return "central_corridor"

    def laser_weapon_armory(self):
        print "You do a dive roll into the Weapon Armory, crouch and scan the room"
        print "for more Gothons that might be hiding. It's dead quiet, to quiet,"
        print "You stand up and run to the far side of the room and find the"
        print "neutron bomb in its container. There's a keypad lock on the box"
        print "and you need the code to get the bomb out. If you get the code"
        print "get the bomb. The code is 3 digits."
        code = "%d%d%d" % (randint(1,9), randint(1,9), randint(1,9))
        guess = raw_input("[keypad]")
        guesses = 0

        while guess != code and guesses < 10:
            print "BZZZZEDDD!"
            guesses += 1
            guess = raw_input("[keypad]> ")

        if guess == code:
            print "The container clicks open and seal breaks, letting gas out."
            print "You grab the neutron bomb and run as fast as you can to the"
            print "bridge where you must place it in the right spot."
            return 'the_bridge'

        else:
            print "The lock buzzes one last time and then you hear a sickening"
            print "melting sound as the mechanism is fused together."
            print "You decide to sit there, and finally the Gothons blow up"
            print "ship from their ship and you die."
            return 'death'

    def the_bridge(self):
        print "You burst onto the Bridge with the netron destruct bomb"


        action = raw_input("> ")

        if action == "throw the bomb":
            print "In a panic you throw the bomb at the group of Gothons"
            return 'death'

        elif action == "slowly place the bomb":
            print "You point your blaster at the bomb under your arm"
            return 'escape_pod'

        else:
            print "DOES NOT COMPUTE!"
            return "the_bridge"

    def escape_pod(self):
        print "You rush through the ship desperately trying to make it to"


        good_pod = randint(1,5)
        guess = raw_input("[pod #]> ")

        if int(guess) != good_pod:
            print "You jump into pod %s and hit the eject button." % guess
            return 'death'

        else:
            print "You jump into pod %s and hit the eject button." % guess
            print "time. You won!"
            exit(0)

a_game = Game("central_corridor")
a_game.play()
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T03:42:33+00:00Added an answer on June 10, 2026 at 3:42 am

    You misspelled __init__:

    def __int__(self, start):
            ^ no "i"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been working on Learn Python the Hard Way 2nd Ed and it
I have been working on getting a python CGI script to work all day,
I am currently working with Python and have been confused over the fact that
I have been working on a shop that is built in Python on the
I am new to python and have been working through the examples in Swaroop
I just started working on Python and have been trying to run an outside
I am working in a Python program with Javascript and DB. I have been
I've been working on a text-based game in Python, and I've come across an
I have been using python with regex to clean up a text file. I
I have been working on the problems presented in Python Challenge . One of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.