Python
Задача 1
num = input()
print(sum([int(i) for i in num]))
Задача 2
print(len(num))
Более простой вариант
summ = 0
for i in num:
summ += int(i)
print(summ)
count = 0
count += 1
print(count)
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Python
Задача 1
num = input()
print(sum([int(i) for i in num]))
Задача 2
num = input()
print(len(num))
Более простой вариант
Задача 1
num = input()
summ = 0
for i in num:
summ += int(i)
print(summ)
Задача 2
num = input()
count = 0
for i in num:
count += 1
print(count)