我的游戏中的随机物品掉落系统有问题。
这是我的代码:
import random
#Potato heals +5
potato = "Potato"
apple = 1
apple_name = "apple"
#is_damage_2
rusted_sword = "Rusted shortsword"
#Worth $80 - 10 can make Goldblade
gold_ingot = "Gold ingot"
#Worth $120
sapphire = "Sapphire"
random_drop = [sapphire,potato,gold_ingot,rusted_sword]
inventory = [apple_name, apple,]
rand_item = random.choice(random_drop)
inventory += rand_item
print(inventory)
当它打印库存时...随机项目被添加,但它是这样拼写一个字母的:P,o,t,a,t,o。
我希望它拼写为:“土豆”
我只学了几周 Python,很困惑。任何帮助将不胜感激!
贾斯汀
隔江千里
相关分类