需要帮助来描述和理解一些python代码

时间:2016-11-17 08:25:38

标签: python python-2.7

如果有人能帮我理解这个程序中的每一行代码,我真的很感激。谢谢

sentence = "ASK NOT WHAT YOUR COUNTRY CAN DO FOR YOU ASK WHAT YOU CAN DO FOR YOUR COUNTRY"
s = sentence.split() 
another = [0] 

 print(sentence)
for count, x in enumerate(s): 
    if s.count(x) < 2:
        another.append(max(another) + 1)
    else:
        another.append(s.index(x) +1)
another.pop(0) 

print(another)

1 个答案:

答案 0 :(得分:0)

Python debugger 01

Python debugger 02

python debugger 03

Python debugger 04

使用此资源来帮助您研究如何调试和理解代码。