-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpython.html
More file actions
36 lines (20 loc) · 886 Bytes
/
Copy pathpython.html
File metadata and controls
36 lines (20 loc) · 886 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
29
30
31
32
33
34
35
36
--https://repl.it/languages/python3
values_string = input("Enter your string: ")
values_array = values_string.split()
values_lengths = "";
for strval in values_array:
values_lengths += str(len(strval.replace("|", ""))) + ","
values_lengths = values_lengths[:-1]
print("Here are the values so far: " + str(values_array) + " lengths: " + values_lengths)
s = ""
values_concat = s.join(values_array).replace("|", "") + "|" + str(values_lengths)
print("Output 1st function: " + values_concat)
secfunc_array = values_concat.split("|")
secfunc_values = secfunc_array[0]
secfunc_lengths = secfunc_array[1].split(",")
output_secfunc = []
curr_pos = 0
for len_str in secfunc_lengths:
output_secfunc.append(secfunc_values[curr_pos:int(len_str) + curr_pos])
curr_pos += int(len_str)
print("Output 2nd function: " + str(output_secfunc))