-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTakseer.py
More file actions
29 lines (28 loc) · 825 Bytes
/
Copy pathTakseer.py
File metadata and controls
29 lines (28 loc) · 825 Bytes
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
def transform_string(input_string):
input_string = input_string.replace(" ","")
result = ""
length = len(input_string)
last = length - 1
if length % 2 == 0:
for i in range(length // 2):
result += input_string[i]
result += input_string[last]
last -= 1
else:
# if length % 2 == 1:
length = length - 1
for i in range(length // 2):
result += input_string[i]
result += input_string[last]
last -= 1
if i == length // 2 - 1:
result += input_string[i + 1]
arr.append(result)
print(result)
if result != check:
transform_string(arr[-1])
arr = []
input_string = input("enter: ")
arr.append(input_string)
check = arr[-1].replace(" ", "")
transform_string(arr[-1])