请问老师,这个程序为什么在线运行就是不通过?第五周第三题!

mooc1480906736769 发表于2017年07月30日
<p>def index_vol(str_id):</p><p>&nbsp; &nbsp; i=0</p><p>&nbsp; &nbsp; name_s='abcdefghijklmnopqrstuvwxyz'</p><p>&nbsp; &nbsp; i=name_s.find(str_id)</p><p>&nbsp; &nbsp; if i==-1:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; return 0</p><p>&nbsp; &nbsp; else:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; return i+1</p><p>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</p><p>import string</p><p>stopword=''</p><p>str_input=[]</p><p>sun_i=0</p><p>flag=1</p><p>while flag==1:</p><p>&nbsp; &nbsp; inputword=raw_input()</p><p>&nbsp; &nbsp; stopword=inputword.strip()</p><p>&nbsp; &nbsp; if stopword=='':</p><p>&nbsp; &nbsp; &nbsp; &nbsp; flag=0</p><p>&nbsp; &nbsp; &nbsp; &nbsp; break</p><p>&nbsp; &nbsp; else:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; str_input.append(stopword)</p><p><br ></p><p>for str_test in str_input:</p><p>&nbsp; &nbsp; sun_i=0</p><p>&nbsp; &nbsp; str_test=str_test.lower()</p><p>&nbsp; &nbsp; for str_test_i in str_test:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; sun_i=sun_i+index_vol(str_test_i)</p><p>&nbsp; &nbsp; print sun_i</p><p>print</p><p><br ></p>
1 回复