Skip to content
Permalink
Fetching contributors…
Cannot retrieve contributors at this time
31 lines (25 sloc) 535 Bytes
# Define string, make it a list, count and remove spaces
string = 'The quick brown fox jumps over the lazy dog'
f = [char.lower() for char in string]
spaces = 0
for char in f:
if (char == ' '):
f.remove(char)
spaces += 1
# Code new string
coded = []
j = 0
while True:
i = j
if (len(coded) == len(f) + spaces):
break
while (i < len(f)):
coded.append(f[i])
i += 8
coded.append(' ')
j += 1
# Convert to string
new_string = ''
for letter in coded:
new_string += letter
print(new_string)
You can’t perform that action at this time.