是不正确的python语句_Python if语句读取不正确

所以我在做一个基于文本的游戏,我有一个商店,你可以在那里卖矿石。我有一份if声明,检查你想卖的矿石数量是否大于你的数量。不管我输入什么号码,上面都写着我的钱不够。在copore = 100 #testing

op = raw_input(p)

if op.lower() == "copper":

print"""

You have %r copper ore.

How much would you like to sell?

""" % copore

op = raw_input(p)

if op.lower() > copore:

print"""

You do not have that much copper ore.

You have %r copper ore.

""" % copore

menu()

elif op.lower() <= copore:

copore = copore - op

gold = gold + (op * 2)

print"""

You sell your copper ore for 2 gold each.

You now have %r copper ore.

and %r gold.

""" % (copore, gold)

menu()

else:

print"""

That is not a valid number

"""

menu()

这很容易是我自己的愚蠢,但我想让别人看看也没什么坏处。非常感谢。在

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值