aboutsummaryrefslogtreecommitdiff
path: root/challenge-045/orestis-zekai/python/ch-1.py
blob: 9d01f88da750ae005ee45923e0d4484f4753b8e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# 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)