-5

I would really appreciate if someone could help me understand each line of code in this program. Thanks

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 Answers1

0

Python debugger 01

Python debugger 02

python debugger 03

Python debugger 04

Use this resources to aid your research on how to debug and understand code.

Community
  • 1
  • 1
itsmrbeltre
  • 412
  • 7
  • 18