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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T15:39:13+00:00 2026-06-17T15:39:13+00:00

So I have a function for a shop I’m making in a small text

  • 0

So I have a function for a shop I’m making in a small text adventure. Here’s the code:

def shop():
global p #prompt for raw_input
global gold
global arrows

print"""
You enter the small shop and the man at the counter asks "How can I help?"
"""

print"""
"What would you like to buy?" He asks
You look up at the list of items
Copper Axe - 50G
Copper Sword - 50G
Wooden Bow - 30G
Copper Arrows (20) - 20G
Iron Axe - 100G
Iron Sword - 100G
Iron Arrows (20) - 40G
Steel Axe - 200G
Steel Sword - 200G
Steel Arrows (20) - 80G

or type 'exit' to exit the store
    """
print"You have:"
print inv

op = raw_input(p)

if op == "copper axe" or "Copper axe" or "Copper Axe" or "copper Axe":
    if gold < 50:
        print"You do not have enough gold"
        shop()
    else:
        gold = gold - 50
        inv.append("Copper Axe")
        shop()
if op == "copper sword" or "copper Sword" or "Copper sword" or "Copper Sword":
    if gold < 50:
        print"You do not have enough gold"
        shop()
    else:
        gold = gold - 50
        inv.append("Copper Sword")
        shop()
elif op == "Wooden bow" or "wooden bow" or "Wooden Bow" or "wooden Bow":
    if gold < 30:
        print"You do not have enough gold"
        shop()
    else:
        gold = gold - 30
        inv.append("Wooden Bow")
        if arrows < 10:
            print"You should probably buy some arrows"
            shop()
elif op == "Copper Arrows" or "copper arrows" or "Copper arrows" or "copper Arrows":
    if gold < 20:
        print"You do not have enough gold"
        shop()
    else:
        gold = gold - 20
        arrows = arrows + 20
        inv.append("Copper Arrows: %p" % arrows)
        shop()
elif op == "iron axe" or "Iron axe" or "Iron Axe" or "iron Axe":
    if gold < 100:
        print"You do not have enough gold"
        shop()
    else:
        gold = gold - 100
        inv.append("Iron Axe")
        shop()
elif op == "iron sword" or "Iron Sword" or "Iron sword" or "iron Sword":
    if gold < 100:
        print"You do not have enough gold"
        shop()
    else:
        gold = gold - 100
        inv.append("Iron Sword")
        shop()
elif op == "iron arrows" or "Iron arrows" or "Iron Arrows" or "iron Arrows":
    if gold < 40:
        print"You do not have enough gold"
        shop()
    else:
        gold = gold - 40
        iarrows = iarrows + 20
        inv.append("Iron arrows %a" % iarrows)
        shop()
elif op == "Steel Axe" or "steel axe" or "Steel axe" or "steel Axe":
    if gold < 200:
        print"You do not have enough gold"
        shop()
    else:
        gold = gold - 200
        inv.append("Steel Axe")
        shop()
elif op == "Steel Sword" or "steel sword" or "Steel sword" or "steel Sword":
    if gold < 200:
        print"You do not have enough gold"
        shop()
    else:
        gold = gold - 200
        inv.append("Steel Sword")
        shop()
elif op == "Steel Arrows" or "steel arrows" or "Steel arrows" or "steel Arrows":
    if gold < 80:
        print"You do not have enough gold"
        shop()
    else:
        gold = gold - 80
        sarrows = sarrows + 20
        inv.append("Steel Arrows - %a" % sarrows)
elif op == "exit" or "Exit":
    menu()
else:
    synerr() #syntax error function

Basically every time I run it no matter what the raw input is, it returns as a copper axe. Like this:

You enter the small shop and the man at the counter asks "How can I help?"


"What would you like to buy?" He asks
You look up at the list of items
Copper Axe - 50G
Copper Sword - 50G
Wooden Bow - 30G
Copper Arrows (20) - 20G
Iron Axe - 100G
Iron Sword - 100G
Iron Arrows (20) - 40G
Steel Axe - 200G
Steel Sword - 200G
Steel Arrows (20) - 80G

or type 'exit' to exit the store

You have:
[]
>>>fkjas;ldkf

You enter the small shop and the man at the counter asks "How can I help?"


"What would you like to buy?" He asks
You look up at the list of items
Copper Axe - 50G
Copper Sword - 50G
Wooden Bow - 30G
Copper Arrows (20) - 20G
Iron Axe - 100G
Iron Sword - 100G
Iron Arrows (20) - 40G
Steel Axe - 200G
Steel Sword - 200G
Steel Arrows (20) - 80G

or type 'exit' to exit the store

You have:
['Copper Axe']
>>>

So does anyone know what could be causing this?

  • 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-17T15:39:14+00:00Added an answer on June 17, 2026 at 3:39 pm

    This expression:

    op == "copper axe" or "Copper axe" or "Copper Axe" or "copper Axe"
    

    Is evaluated like this:

    (op == "copper axe") or "Copper axe" or "Copper Axe" or "copper Axe"
    

    Here’s what you want:

    op == "copper axe" or op == "Copper axe" or op == "Copper Axe" or op == "copper Axe"
    

    BTW, here’s a shortcut, converting to lowercase:

    op.lower() == "copper axe"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm making an online shop. I have two models: Product and Category . Product
Here in this code i have to display all the records from the Table(cust_college).
I have function like this: function ypg_delete_img($id, $img) { $q = $this->ypg_get_one($id); $imgs =
I have function LoadTempMovieList(), and need to load movies from sessionStorage. But it seems
i have function public Menu Details(int? id) { return _dataContext.Menu.Include(ChildMenu).FirstOrDefault(m => m.MenuId == id);
I have function: char *zap(char *ar) { char pie[100] = INSERT INTO test (nazwa,
I have function getCartItems in cart.js and I want to call that function in
I have function Start() that is fired on ready. When I click on .ExampleClick
I have function some_func_1 which will create an object of type some_type and will
I have function like this: function gi_insert() { if(!IS_AJAX){ $this->load->library('form_validation'); $this->form_validation->set_rules('name', 'Naslov', 'trim|required|strip_tags'); $this->form_validation->set_rules('body',

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.