萌萌萌萌新12138 2018-11-02 17:43 采纳率: 100%
浏览 522
已采纳

能否帮我看一下我这代码有什么问题(Python3.7)求大佬指点萌新

#story of "Ji You Feng"
skill = ["sword","spear","bow","axe"]
power = [98.5,89.2,100,79.2]

#start of function
def printItem(inSkill, idx=0):
name = "Ji You Feng"
age = 18
weight = 69.3

print ("\n")
print ("------------------------------")
print ("1.name:", name)
print ("2.age:", age)
print ("3.weight", weight)

print ("4.armed weapon:", inSkill, "[power',power[idx],']")
print (">>>i am ready to fight")
#end of function

querySkill = raw_input("select weapon:")

i = 0

for   each_item in skill :
    if(each_item == querySkill):
        printItem(querySkill,i)
    i = i+1
print ("------------------------------" )
print ("\n")
  • 写回答

2条回答 默认 最新

  • Italink 2018-11-02 19:58
    关注
     skill = ["sword","spear","bow","axe"]
    power = [98.5,89.2,100,79.2]
    #start of function
    def printItem(inSkill, idx=0):
        name = "Ji You Feng"
        age = 18
        weight = 69.3
        print ("\n")
        print ("------------------------------")
        print ("1.name:", name)
        print ("2.age:", age)
        print ("3.weight", weight)
        print ("4.armed weapon:", inSkill, "[power',power[idx],']")
        print (">>>i am ready to fight")
    #end of function
    querySkill = input("select weapon:")
    i = 0
    for   each_item in skill :
        if(each_item == querySkill):
            printItem(querySkill,i)
        i = i+1
    print ("------------------------------" )
    print ("\n")
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)
编辑
预览

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部