如果有人能帮我理解这个程序中的每一行代码,我真的很感激。谢谢
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)
答案 0 :(得分:0)