能否帮我看一下我这代码有什么问题(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个回答

 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")
qq_43423399
萌萌萌萌新12138 回复qq_40946921: 那可真是太巧了hhh
一年多之前 回复
qq_43423399
萌萌萌萌新12138 回复qq_40946921: emmm
一年多之前 回复
qq_40946921
Italink 你这头像,好像我同学=.=
一年多之前 回复

raw_input是python2的写法,python只有input,把raw_input改成input

qq_43423399
萌萌萌萌新12138 File "C:\Users\DELL\AppData\Roaming\Sublime Text 3\Packages\User\1.py", line 23 i = 0 ^ IndentationError: unexpected indent
一年多之前 回复
qq_43423399
萌萌萌萌新12138 可是还是不行。。
一年多之前 回复
qq_43423399
萌萌萌萌新12138 谢谢大佬!
一年多之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问

相似问题

1
pycharm中debug时提示python停止运行,是哪里的问题?
0
python(3.7)+opencv(3.4.4)视频处理
1
python 关于tkinter.Tk().geometry("widthxheight+x+y")参数问题的深入提问。
3
python3.7)print为什么不能打印出内容?
0
python3.7 读取csv文件某一行用plt画图坐标轴乱,不按数字大小排列怎么解决?
2
求教:python paramiko库:paramiko.ssh_exception.SSHException: not a valid RSA private key file
3
python3.6 kivy 环境搭建问题
7
关于Python3.7中安装pip install Scrapy出现的问题
1
ModuleNotFoundError: No module named 'pip._vendor.urllib3.packages'出现这种错误是什么意思?
1
Windows 7环境下Python3.7.3版本类导入问题
0
Python + C/C++ 嵌入式编程:Qt向Python传递数组
0
python3.7 要从串口读数据保存到文件,运行后发现如发送的数据中文字比较多就会出现乱码或丢数据。
1
Python3.7+Pyside2 运行exe文件提示“ImportError: DLL load failed: 找不到指定的程序。
2
Spyder/python3.7怎么修改默认编码格式?
1
python爬虫爬取时提示org.xml.sax.SAXParseException: Content is not allowed in prolog.
1
鼠标拖动报错,一直在网上找不到答案,求大神支招
1
pyinstaller打包后os.system("shutdown -s")命令失效,在pycharm中运行就没问题
1
python的kivy框架的第一个简单示例报错kivy.factory.FactoryException: Unknown class <ListView>?
2
小白,想用Python3.7+Opencv4.1.1+APP:IP摄像头,调用手机的摄像头。 结果出现如下状况,还请各位大佬指点!