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 8601827
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T01:56:05+00:00 2026-06-12T01:56:05+00:00

Im teaching myself using Zed Shaw’s Learn Python The Hard Way, and I’m having

  • 0

Im teaching myself using Zed Shaw’s Learn Python The Hard Way, and I’m having trouble with an extra credit exercise where he has us making our own text adventure game.

I thought I was doing pretty well when I finished this code in a few hours, but to my dismay it keeps running the first encounter over and over again. My brain is fried and I cant figure out why the first encounter keeps occurring. Maybe you guys see something I dont?

In closing, how can I get this code to work correctly and in order?

# First Encounter (main program really)
def fi_en():
    print"""
It smells of damp vegetation, and the air is particularly thick. You can 
hear some small animals in the distance. This was a nice place to sleep.

1. Stay close, find some cover, and wait for food to show up.

2. Explore the nearby marsh & find the nearest river, following it downstream."

3. Walk towards the large mysterious mountain in the distance. 
"""
    answer = raw_input(prompt)
    if answer == 1:
        cun_one = roll_3d6()
        if cun_one <= cun - 2:
            print"""Time passes as eventually you capture some varmints.
You feel slightly more roguish."""
            cun = cun + 1
            fi_en()
        else: 
            print """Time passes and a group of slavers marches into right 
where you are hiding in the woods. They locate you, capture you, and haul you
away for a lifetime of servitude in the main city.
Goodbye %s""" % name
    elif answer == 2: 
        power = roll_3d6()
        if power <= pow -4:
            print"""You trudge through the marshes until you eventually reach 
a large river. Downstream from the river is a large temple covered in vines,
you walk towards it. You feel more powerful."""
            pow = pow + 2
            te_en()
        else:
            print """The vegetation here wraps itself around your legs making
it impossible to move. You will most likely die here in the vegetation. 
Goodbye %s.""" % name
    elif answer == 3:
        cun_two = roll_3d6()
        if cun_two <= cun:
            print """You make your way towards the mountain and you encounter
a really large group of devil dogs guarding the entrance to the mountain."""
            dd_en()
    else: 
        print"You have gotten lost and ended up right where you started."
        fi_en()




######################## MAIN PROGRAM ###################################################
prompt = "> "

print "\n\t\tWelcome to LeGeNeD oF DoObIeUs..."

print "\n\t\tProgrammed using Python 2.7 by Ray Weiss"

name = raw_input("\nWhat is your name brave rogue? > ")

print "\nOk %s, lets roll up some character stats." % name
print "\nPress enter to roll 3D6 for each stat."
raw_input()

display_stats()

print "\nThese are your stats. They can be changed by things in game."

print "\nThese stats will have an effect on the outcomes that you choose."

print "\nYou will be presented with many choices, type in a number."

print "\nOr risk typing something different."

print "\nPress enter to start the game"
raw_input()

print"""You are Doobieus, you are but a wandering rogue in the vast, 
mysterious, and deadly land of Calgaria. Your goal is to survive. 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You have just woken up in the woods, its really cold, and you are hungry."""

fi_en()

Here is my output

You have just woken up in the woods, its really cold, and you are hungry.

It smells of damp vegetation, and the air is particularly thick. You can 
hear some small animals in the distance. This was a nice place to sleep.

1. Stay close, find some cover, and wait for food to show up.

2. Explore the nearby marsh & find the nearest river, following it downstream."

3. Walk towards the large mysterious mountain in the distance. 

> 2
You have gotten lost and ended up right where you started.

It smells of damp vegetation, and the air is particularly thick. You can 
hear some small animals in the distance. This was a nice place to sleep.

1. Stay close, find some cover, and wait for food to show up.

2. Explore the nearby marsh & find the nearest river, following it downstream."

3. Walk towards the large mysterious mountain in the distance. 

>
  • 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-12T01:56:06+00:00Added an answer on June 12, 2026 at 1:56 am

    Try this:

    print '2' == 2
    

    Get it?

    EDITTED TO ADD:

    A slightly less snarky answer — as noted by a commenter to the OP, the issue is that raw_input returns a string and you are comparing all of your responses as integers.

    You could change answer to an int, but why bother? Why not just change your code so your are checking to see if the answer is a specific string?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm a Python(3.1.2)/emacs(23.2) newbie teaching myself tkinter using the pythonware tutorial found here .
I'm teaching myself Zend am and having a problem with using my session to
I have been teaching myself OpenGL programming using the Python wrapper PyOpenGL, and am
I'm teaching myself Rails through PragProg's (apparently outdated - I'm using Rails 3.2.3) Rails
I'm teaching myself Python 3.2 and I'm trying to make a program to match
I am teaching myself python. I was thinking of small programs, and came up
I'm teaching myself OpenGL and I'm implementing ttf text rendering using FreeType 2. I
I'm teaching myself some Django tonight using the local dev package at instantdjango.com I
Teaching myself SQL, and using an employee info db, on oracle 11g. I'm trying
I am teaching myself Python and am running into a strange problem. What I

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.