diff --git a/practica/stepik/sketches/sketches.py b/practica/stepik/sketches/sketches.py index 627d577..80d42e9 100644 --- a/practica/stepik/sketches/sketches.py +++ b/practica/stepik/sketches/sketches.py @@ -35,7 +35,14 @@ # print() -num = 1234 -lst = [int(i) for i in str(num)] -print (num) -print (lst) \ No newline at end of file +initial_list = input().split() +sum_list = [] +left_index = -1 +right_index = -len(initial_list) + 1 +middle_index = 0 +while middle_index < len(initial_list): + sum_list.append(initial_list[left_index] + initial_list[right_index]) + left_index += 1 + right_index += 1 + middle_index += 1 +print(sum_list) \ No newline at end of file diff --git a/practica/stepik/stepik_tasks/sum_num_from_last.py b/practica/stepik/stepik_tasks/sum_num_from_last.py new file mode 100644 index 0000000..94710ab --- /dev/null +++ b/practica/stepik/stepik_tasks/sum_num_from_last.py @@ -0,0 +1,12 @@ +# # начиная с конца обьединяет элементы между собой +# initial_list = input().split() +# sum_list = [] +# left_index = -1 +# right_index = -len(initial_list) + 1 +# middle_index = 0 +# while middle_index < len(initial_list): +# sum_list.append(initial_list[left_index] + initial_list[right_index]) +# left_index += 1 +# right_index += 1 +# middle_index += 1 +# print(sum_list) diff --git a/practica/stepik/stepik_tasks/sum_num_nearby.py b/practica/stepik/stepik_tasks/sum_num_nearby.py index 16b7bdb..caa0217 100644 --- a/practica/stepik/stepik_tasks/sum_num_nearby.py +++ b/practica/stepik/stepik_tasks/sum_num_nearby.py @@ -18,6 +18,4 @@ for index, number in enumerate(a): S2 = int(a[0]) + int(a[-2]) b += " " + str(S2) print (b) -x = [int(m) for m in str(b)] -print (x) -# print (" ".join(b)) \ No newline at end of file +