add new
This commit is contained in:
parent
b2ccd909ae
commit
9de3bfad0f
@ -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)
|
12
practica/stepik/stepik_tasks/sum_num_from_last.py
Normal file
12
practica/stepik/stepik_tasks/sum_num_from_last.py
Normal 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)
|
@ -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))
|
|
||||||
|
Loading…
Reference in New Issue
Block a user