import string
loop = True
while loop is True:
    sentence = input("Enter sentence to compress: \n>")             #user enters a sentence
    if not any(word in sentence for word in string.ascii_letters):  #if there are no letters from the alphabet in the sentence then get angry
        print("What do you expect me to do with this?")
    else:
        loop = False                                                #end the while loop
sentencelist = sentence.split()                                     # sentence is split into induvidual words and then stored in a list called sentencelist
words = {}                                                          #create a blank array for later
index = 0                                                           #set the index value at 0 to start
for word in sentencelist:                                           #goes through each item in the sentencelist
    if word not in words:                                           #if the item isn't in the words array
        words[word] = index                                         #the item in the words arrays index is changed to the apropriate position
        index += 1                                                  #the index variable is increased by one, so the next item found can have its index set to the second position

with open('index.txt', 'w') as f:                                   #opens or creates a file called index
    for word in sentencelist:                                       #for each item in the sentencelist
        f.write('%d\n' % words[word])                               #write the items position number onto the text document along with a newline for the next item

with open('words.txt', 'w') as f:                                   #opens or creates a file called words
    for word in sentencelist:                                       #for each item in sentencelist
        f.write(word + '\n')                                        #write the item onto the text document along with a newline for the next item
print("File compressed into indexes and words.")                    #informs the user that the compressing process has compelted

abbe618614caa11faf45eb7ae603b51521bcbb91
<mask token>

<mask token>
while loop is True:
    sentence = input('Enter sentence to compress: \n>')
    if not any(word in sentence for word in string.ascii_letters):
        print('What do you expect me to do with this?')
    else:
        loop = False
<mask token>
for word in sentencelist:
    if word not in words:
        words[word] = index
        index += 1
with open('index.txt', 'w') as f:
    for word in sentencelist:
        f.write('%d\n' % words[word])
with open('words.txt', 'w') as f:
    for word in sentencelist:
        f.write(word + '\n')
print('File compressed into indexes and words.')

<mask token>
loop = True
while loop is True:
    sentence = input('Enter sentence to compress: \n>')
    if not any(word in sentence for word in string.ascii_letters):
        print('What do you expect me to do with this?')
    else:
        loop = False
sentencelist = sentence.split()
words = {}
index = 0
for word in sentencelist:
    if word not in words:
        words[word] = index
        index += 1
with open('index.txt', 'w') as f:
    for word in sentencelist:
        f.write('%d\n' % words[word])
with open('words.txt', 'w') as f:
    for word in sentencelist:
        f.write(word + '\n')
print('File compressed into indexes and words.')

import string
loop = True
while loop is True:
    sentence = input('Enter sentence to compress: \n>')
    if not any(word in sentence for word in string.ascii_letters):
        print('What do you expect me to do with this?')
    else:
        loop = False
sentencelist = sentence.split()
words = {}
index = 0
for word in sentencelist:
    if word not in words:
        words[word] = index
        index += 1
with open('index.txt', 'w') as f:
    for word in sentencelist:
        f.write('%d\n' % words[word])
with open('words.txt', 'w') as f:
    for word in sentencelist:
        f.write(word + '\n')
print('File compressed into indexes and words.')

import string
loop = True
while loop is True:
    sentence = input("Enter sentence to compress: \n>")             #user enters a sentence
    if not any(word in sentence for word in string.ascii_letters):  #if there are no letters from the alphabet in the sentence then get angry
        print("What do you expect me to do with this?")
    else:
        loop = False                                                #end the while loop
sentencelist = sentence.split()                                     # sentence is split into induvidual words and then stored in a list called sentencelist
words = {}                                                          #create a blank array for later
index = 0                                                           #set the index value at 0 to start
for word in sentencelist:                                           #goes through each item in the sentencelist
    if word not in words:                                           #if the item isn't in the words array
        words[word] = index                                         #the item in the words arrays index is changed to the apropriate position
        index += 1                                                  #the index variable is increased by one, so the next item found can have its index set to the second position

with open('index.txt', 'w') as f:                                   #opens or creates a file called index
    for word in sentencelist:                                       #for each item in the sentencelist
        f.write('%d\n' % words[word])                               #write the items position number onto the text document along with a newline for the next item

with open('words.txt', 'w') as f:                                   #opens or creates a file called words
    for word in sentencelist:                                       #for each item in sentencelist
        f.write(word + '\n')                                        #write the item onto the text document along with a newline for the next item
print("File compressed into indexes and words.")                    #informs the user that the compressing process has compelted
