Value error stumping a newbie
<p>Im trying to get this extra credit exercise done for <a href="http://learnpythonthehardway.org/book/ex36.html" rel="nofollow">LPTHW</a> and I've hit a wall. I keep getting a value error and I cant tell why. I know I should be using dict's and classes but i havent gotten up to that part in the book yet. </p>

<p>The idea is that I would like to get this inventory function to remove the previous weapon from the list <code>character_sheet</code>and replace it with the weapon the user just bought. here is what i believe is the relevant code, let me know if im missing anything. </p>

<p>thanks in advance, stack overflow has really helped me as i grapple with learning python from no previous experience. </p>

<pre><code>weapon_choice = raw_input(":&gt; ")
        if "sword" in weapon_choice:
            current_weapon = weapons[0]
            inventory(weapons[0])
            character_sheet.append("Current Weapon %s" % current_weapon)
        elif weapons[1] in weapon_choice:
            current_weapon = weapons[1]
            inventory(weapons[1])
            character_sheet.append("Current Weapon %s" % current_weapon)
        elif weapons[2] in weapon_choice:
            current_weapon = weapons[2]
            inventory(weapons[2])
            character_sheet.append("Current Weapon %s" % current_weapon)
        else: 
            print "I dont know what %s means" % weapon_choice
            buy_weapon(level_zero_weapons)
</code></pre>

<p>here is the next bit of relevant code. </p>

<pre><code>weapon_choice = raw_input(":&gt; ")
        if weapons[0] in weapon_choice:
            character_sheet.remove(current_weapon)
            current_weapon = weapons[0]
            inventory(weapons[0])
            character_sheet.append("Current Weapon %s" % current_weapon)
        elif weapons[1] in weapon_choice:
            character_sheet.remove(current_weapon)
            current_weapon = weapons[1]
            inventory(weapons[1])
            character_sheet.append("Current Weapon %s" % current_weapon)
        elif weapons[2] in weapon_choice:
            character_sheet.remove(current_weapon)
            current_weapon = weapons[2]
            inventory(weapons[2])
            character_sheet.append("Current Weapon %s" % current_weapon)
</code></pre>

<p>Here are the lists im dealing with. </p>

<pre><code># Weapon lists 
level_zero_weapons = ['short sword', 'club', 'dagger']
level_one_weapons = ['sword', 'mace', 'rapier']
level_two_weapons = ['long sword', 'morningstar', 'trident']
level_three_weapons = ['claymore', 'flail', 'sycthe']
level_four_weapons = ['bastard sword', 'dragon bone', 'crystal halbred']
</code></pre>

<p>And here is my output, I dont get it, let me know if i should add more code. </p>

<pre><code>Please tell me your name brave soul. :&gt; Ray

        Lets now randomly generate brave gladiator Ray.
[                             'Name: Ray:',
                              'Gender: Male',
                              'Character Class: Warrior',
                              'Strength: 11',
                              'Dexterity: 7',
                              'Constitution: 8',
                              'Damage 1D6',
                              'Crit Chance 10%',
                              'Hit Points: 6/6']
Please Press Enter To Buy A Weapon

Please type in the weapon you want to buy.

short sword, price: 1 gold pieces

club, price: 1 gold pieces

dagger, price: 1 gold pieces.

:&gt; dagger

Your current weapon is now a dagger. Press Enter To Continue


Type in the weapon you want to buy, type quit to return to the barracks.

sword, price: 3 gold pieces

mace, price: 4 gold pieces

rapier, price: 5 gold pieces.

:&gt; sword
Traceback (most recent call last):
  File "lodarena.py", line 399, in &lt;module&gt;
    character_gen()
  File "lodarena.py", line 394, in character_gen
    buy_weapon(level_one_weapons)
  File "lodarena.py", line 144, in buy_weapon
    character_sheet.remove(current_weapon)
ValueError: list.remove(x): x not in list
Raymond-Weisss-MacBook-Pro:lodarena Raylug$ 
</code></pre>

<p>EDIT: here is my whole buy weapon method.</p>

<pre><code># Doing Stuff for weapons and the shopkeeper. #################################

def level_zero_price():
    """Generates the price for level one weapons"""
    return randint(1, 3)

def level_one_price():
    """Generates the price for level two weapons"""
    return randint(3, 6)

def level_two_price():
    """Generates the price for level three weapons"""
    return randint(6, 9)

def level_three_price():
    """Generates the price for level four weapons"""
    return randint(9, 12)

def level_four_price():
    "Generates the price for level four weapons"""
    return randint(12, 15)
### Major Buying Stuff / Inventory Code ##########################################

def buy_weapon(weapons):
    """big bit of code that allows you to buy a weapons from a weapon list.
The function acts a little differently after level zero weapons"""
    global current_weapon
    if weapons == level_zero_weapons:
        sword_price = level_zero_price()
        blunt_price = level_zero_price()
        agile_price = level_zero_price()
        print t.bright_yellow_on_magenta + """
Please type in the weapon you want to buy.

%s, price: %d gold pieces

%s, price: %d gold pieces

%s, price: %d gold pieces.
""" % (weapons[0], sword_price, weapons[1], blunt_price,weapons[2], 
       agile_price)

        weapon_choice = raw_input(":&gt; ")
        if weapons[0] in weapon_choice:
            current_weapon = weapons[0]
            inventory(weapons[0])
            character_sheet.append("Current Weapon %s" % current_weapon)
        elif weapons[1] in weapon_choice:
            current_weapon = weapons[1]
            inventory(weapons[1])
            character_sheet.append("Current Weapon %s" % current_weapon)
        elif weapons[2] in weapon_choice:
            current_weapon = weapons[2]
            inventory(weapons[2])
            character_sheet.append("Current Weapon %s" % current_weapon)
        else: 
            print "I dont know what %s means" % weapon_choice
            buy_weapon(level_zero_weapons)

    elif weapons == level_one_weapons:
        sword_price = level_one_price()
        blunt_price = level_one_price()
        agile_price = level_one_price()
        print"""
Type in the weapon you want to buy, type quit to return to the barracks.

%s, price: %d gold pieces

%s, price: %d gold pieces

%s, price: %d gold pieces.
""" % (weapons[0], sword_price, weapons[1], blunt_price, weapons[2],
       agile_price)

        weapon_choice = raw_input(":&gt; ")
        if weapons[0] in weapon_choice:
            character_sheet.remove(current_weapon)
            current_weapon = weapons[0]
            inventory(weapons[0])
            character_sheet.append("Current Weapon %s" % current_weapon)
        elif weapons[1] in weapon_choice:
            character_sheet.remove(current_weapon)
            current_weapon = weapons[1]
            inventory(weapons[1])
            character_sheet.append("Current Weapon %s" % current_weapon)
        elif weapons[2] in weapon_choice:
            character_sheet.remove(current_weapon)
            current_weapon = weapons[2]
            inventory(weapons[2])
            character_sheet.append("Current Weapon %s" % current_weapon)
        else: 
            print "I dont know what %s means" % weapon_choice
            buy_weapon(level_one_weapons)

    elif weapons == level_two_weapons:
        sword_price = level_two_price()
        blunt_price = level_two_price()
        agile_price = level_two_price()
        print"""
Type in the weapon you want to buy, type quit to return to the barracks.

%s, price: %d gold pieces

%s, price: %d gold pieces

%s, price: %d gold pieces.
""" % (weapons[0], sword_price, weapons[1], blunt_price,weapons[2], 
       agile_price)

        weapon_choice = raw_input(":&gt; ")
        if weapons[0] in weapon_choice:
            character_sheet.remove(current_weapon)
            current_weapon = weapons[0]
            inventory(weapons[0])
            character_sheet.append("Current Weapon %s" % current_weapon)
        elif weapons[1] in weapon_choice:
            character_sheet.remove(current_weapon)
            current_weapon = weapons[1]
            inventory(weapons[1])
            character_sheet.append("Current Weapon %s" % current_weapon)
        elif weapons[2] in weapon_choice:
            character_sheet.remove(current_weapon)
            current_weapon = weapons[2]
            inventory(weapons[2])
            character_sheet.append("Current Weapon %s" % current_weapon)
        else: 
            print "I dont know what %s means" % weapon_choice
            buy_weapon(level_two_weapons)

    elif weapons == level_three_weapons:
        sword_price = level_three_price()
        blunt_price = level_three_price()
        agile_price = level_three_price()
        print"""
Type in the weapon you want to buy, type quit to return to the barracks.

%s, price: %d gold pieces

%s, price: %d gold pieces

%s, price: %d gold pieces.
""" % (weapons[0], sword_price, weapons[1], blunt_price,weapons[2], 
       agile_price)

        weapon_choice = raw_input(":&gt; ")
        if weapons[0] in weapon_choice:
            character_sheet.remove(current_weapon)
            current_weapon = weapons[0]
            inventory(weapons[0])
            character_sheet.append("Current Weapon %s" % current_weapon)
        elif weapons[1] in weapon_choice:
            character_sheet.remove(current_weapon)
            current_weapon = weapons[1]
            inventory(weapons[1])
            character_sheet.append("Current Weapon %s" % current_weapon)
        elif weapons[2] in weapon_choice:
            character_sheet.remove(current_weapon)
            current_weapon = weapons[2]
            inventory(weapons[2])
            character_sheet.append("Current Weapon %s" % current_weapon)
        else: 
            print "I dont know what %s means" % weapon_choice
            buy_weapon(level_three_weapons)

    elif weapons == level_four_weapons:
        sword_price = level_four_price()
        blunt_price = level_four_price()
        agile_price = level_four_price()
        print"""
Type in the weapon you want to buy, type quit to return to the barracks.

%s, price: %d gold pieces

%s, price: %d gold pieces

%s, price: %d gold pieces.
""" % (weapons[0], sword_price, weapons[1], blunt_price,weapons[2], 
       agile_price)

        weapon_choice = raw_input(":&gt; ")
        if weapons[0] in weapon_choice:
            character_sheet.remove(current_weapon)
            current_weapon = weapons[0]
            inventory(weapons[0])
            character_sheet.append("Current Weapon %s" % current_weapon)
        elif weapons[1] in weapon_choice:
            character_sheet.remove(current_weapon)
            current_weapon = weapons[1]
            inventory(weapons[1])
            character_sheet.append("Current Weapon %s" % current_weapon)
        elif weapons[2] in weapon_choice:
            character_sheet.remove(current_weapon)
            current_weapon = weapons[2]
            inventory(weapons[2])
            character_sheet.append("Current Weapon %s" % current_weapon)
        else: 
            print "I dont know what %s means" % weapon_choice
            buy_weapon(level_four_weapons)      
    else:
        print"~~~There is a bug somwhere, forgot to assign (weapons)\n\n\n"
    raw_input(t.white_on_red("""
Your current weapon is now a %s. Press Enter To Continue
""" % current_weapon))
</code></pre>
