Ask coding questions

← Back to all posts
if command help
KeeganMcGough (1)

if answer == "!shop":
if (WoodCount >= (20)):
print("Current things you can buy in the shop")
print("Tent")
print("----------------------------------------------")
elif (WoodCount <= (20)):
print( "You do not have enough wood to make anything yet answer another question."
)
print("----------------------------------------------")
else:
print("There is no command with this name.")
if answer == "!getwood":
print ("What is a bird with 'Wood' in its name?")
answer = raw_input(">")
if answer == "Woodpecker":
(WoodCount) += (10)

So when I have 20 wood and I do !shop the command works fine.
When I have 10 wood and I do this command nothing appears.
When I have 0 wood and I do this command nothing appears.
When I do !getwood print( "You do not have enough wood to make anything yet answer another question.") appears.

help

Comments
hotnewtop
Geocube101 (628)

I went ahead and looked at your repl (I believe 'Build a town' is the name)
On line 48:
indent the 'elif' and following commands up until 'else'

Your 'elif' command has no indent and so it isn't testing the else if part of the 'if (WoodCount >= (20)):'