Python Forum
I'm not sure why this code isn't printing... Can someone tell me?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I'm not sure why this code isn't printing... Can someone tell me?
#1
Can someone tell me what's wrong with the code down below? It isn't printing and I've tried removing the int() and all that but it just won't print? I have my complete code below

print "You do " + int(hero_att) + " with your " + hero_weapon + "!"

Get to the error by
-Enter Name
-Choose weapon
-say Stay
-say Yes
-choose Attack
________________________________________________________________________________________________________________


hero_hp = 50

bow_stats = "Bow Stats: Attack - 7   Defense - 2   Range - 5"
bow_att = 7
bow_def = 2
bow_ran = 5

sword_stats = "Sword Stats: Attack - 10   Defense - 2   Range - 1"
sword_att = 10
sword_def = 2
sword_ran = 1

spear_stats = "Spear Stats: Attack - 6   Defense - 4   Range - 2"
spear_att = 6
spear_def = 4
spear_ran = 2

monster_1_hp = 10
monster_1_att = 7
monster_1_def = 0
monster_1_ran = 1

print "WARNING!"
print "THIS GAME IS CASE SENSITIVE WHEN ANSWERING!"
print "ALWAYS ANSWER WITH THE FIRST LETTER CAPITAL!"
print "THIS IS STILL A WORK IN PROGRESS!!!"
print ""
print ""
print ""
hero_name = input("Enter Your Hero's Name: ")
print ""
print "Hello Sir " + hero_name + ", my name is Grima."
print "I will be your guide on this journey!"
print "But first, you must choose your weapon!"
print "What will it be?" 
print "If you wish to know the weapons stats, type 'Info'"
print "Bow, Sword, Spear, or Info?"
hero_weapon = input("What do you choose: ")

if hero_weapon == "Info":
    print bow_stats
    print sword_stats
    print spear_stats
    hero_weapon = input("Bow, Sword, or Spear: ")

if hero_weapon == "Bow":
    print "You have chosen the Bow!"
    hero_att = bow_att
    hero_def = bow_def
    hero_ran = bow_ran

if hero_weapon == "Sword":
    print "You have chosen the Sword!"
    hero_att = sword_att
    hero_def = sword_def
    hero_ran = sword_ran

if hero_weapon == "Spear":
    print "You have chosen the Spear!"
    hero_att = spear_att
    hero_def = spear_def
    hero_ran = spear_ran

print ""
print "You arrive at the door to the dungeon!"
choice_1 = input("Do you 'Leave' or 'Stay'?")

if choice_1 == "Leave":
    print ""
    print "You decide to leave and go live a plain old..."
    print "boring life in the city."
    print "You live to see the dragon that was..."
    print "at the end of the dungeon slay everyone..."
    print "and conquer the world!!!"
    print ""
    print "THE BAD ENDING"
    
if choice_1 == "Stay":
    print "You decide to stay!"
    print "When you open the door to the dungeon..."
    print "You see a descending staircase down into the dungeon..."

if choice_1 == "Stay":  
    decision = input("Do you still wish to continue?(Yes/No) ")
    print ""

if decision == "No":
    print ""
    print "You decide to leave and go live a plain old..."
    print "boring life in the city."
    print "You live to see the dragon that was..."
    print "at the end of the dungeon slay everyone..."
    print "and conquer the world!!!"
    print ""
    print "THE BAD ENDING"
    
if decision == "Yes":
    print "You decide to continue on with your journey!"
    print "You descend into the first room..."
    print "But there is a monster blocking your path!"
    print "Do you 'Attack' or 'Defend'?"
    ad = input("Attack or Defend? ")
    
if ad == "Attack":
    print "You decide to attack the monster!"
    print "You do " + int(hero_att) + " with your " + hero_weapon + "!"
    ca = hero_att - monster_1_def
    monster_1_hp = monster_1_hp - ca
    print "Monster's Current Health: " + monster_1_hp
    if monster_1_hp > 0:
        print "The monster attacks you!"
        da = monster_1_att - hero_def
        hero_hp = hero_hp - da
        print hero_name + "'s Current Health: " + hero_hp + "!"
        jump(101)
    else:
        print "Congratulations!!!"
        print "You've slayed your very first monster!"
        print "You received 500 gold!"
        print ""
        print "Grima: You have done very well for now..."
        print "But can you beat the next one?"
        print ""
        print ""
        print ""
        print "END!!! (for now...)"
Reply


Messages In This Thread
I'm not sure why this code isn't printing... Can someone tell me? - by Wilminer4 - Mar-01-2018, 03:57 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Code printing twice hypersdevelopment 3 6,370 Sep-09-2018, 12:06 AM
Last Post: hypersdevelopment

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020