Задание 12 выполнил
This commit is contained in:
parent
74d523702d
commit
829ce52d32
10
2.1_lesson.12.20.py
Normal file
10
2.1_lesson.12.20.py
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
****** Задание 12 Параграф 2.1 ******
|
||||||
|
****** Напишите программу, которая складывает два числа поразрядно без учёта переносов. Каждая пара цифр суммируется независимо, и результат записывается в соответствующий разряд. ******
|
||||||
|
|
||||||
|
if name == "main":
|
||||||
|
num1 = list(map(int, input().rjust(3, '0')))
|
||||||
|
num2 = list(map(int, input().rjust(3, '0')))
|
||||||
|
num_0 = str((num1[0] + num2[0]) % 10)
|
||||||
|
num_1 = str((num1[1] + num2[1]) % 10)
|
||||||
|
num_2 = str((num1[2] + num2[2]) % 10)
|
||||||
|
print((num_0 + num_1 + num_2).lstrip('0'))
|
||||||
0
2.1_lesson.13.20.py
Normal file
0
2.1_lesson.13.20.py
Normal file
0
2.1_lesson.14.20.py
Normal file
0
2.1_lesson.14.20.py
Normal file
0
2.1_lesson.15.20.py
Normal file
0
2.1_lesson.15.20.py
Normal file
0
2.1_lesson.16.20.py
Normal file
0
2.1_lesson.16.20.py
Normal file
0
2.1_lesson.17.20.py
Normal file
0
2.1_lesson.17.20.py
Normal file
0
2.1_lesson.18.20.py
Normal file
0
2.1_lesson.18.20.py
Normal file
0
2.1_lesson.19.20.py
Normal file
0
2.1_lesson.19.20.py
Normal file
0
2.1_lesson.20.20.py
Normal file
0
2.1_lesson.20.20.py
Normal file
Loading…
Reference in a new issue