So i want to create a program that asks the user to compress or decompress and if compress it asks for a sentence and compresses the outcome and if decompress it saves the outcome of that in a .txt too. I have this currently.
import pickle
compressopen = input("Do you want to compress or uncompress: ")
compressopen.lower()
if compressopen == "compress":
sentence = input("Please enter a sentence: ")
sentencesplit = sentence.split()
print(sentencesplit)
listnew = []
for x in sentencesplit:
if x not in listnew:
listnew.append(x)
print(listnew)
postion = []
for c in sentencesplit:
(postion.append(listnew.index(c)+1))
elif compressopen == "uncompress":
Aucun commentaire:
Enregistrer un commentaire