This commit is contained in:
Yesen 2023-10-05 14:19:18 +03:00
parent b2ccd909ae
commit 9de3bfad0f
3 changed files with 24 additions and 7 deletions

View File

@ -35,7 +35,14 @@
# print() # print()
num = 1234 initial_list = input().split()
lst = [int(i) for i in str(num)] sum_list = []
print (num) left_index = -1
print (lst) 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)

View File

@ -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)

View File

@ -18,6 +18,4 @@ for index, number in enumerate(a):
S2 = int(a[0]) + int(a[-2]) S2 = int(a[0]) + int(a[-2])
b += " " + str(S2) b += " " + str(S2)
print (b) print (b)
x = [int(m) for m in str(b)]
print (x)
# print (" ".join(b))