def func_first(n):
s = 0
while int(n) > 0:
a = n % 10
n = n // 10
s += a
return s
print(func_first(5145))
import random
def second_func(n):
test_list = [random.randint(0, 50) for i in range(int(n))]
new_list = [x for x in test_list if x % 3 == 0]
print("{}".format(test_list))
print(
"Числа которие делятся на 3 без остатка {}, количиство чисел {}".format(
new_list, len(new_list)))
second_func(12)
def third_func(n):
print(third_func(5145))
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
def func_first(n):
s = 0
while int(n) > 0:
a = n % 10
n = n // 10
s += a
return s
print(func_first(5145))
import random
def second_func(n):
test_list = [random.randint(0, 50) for i in range(int(n))]
new_list = [x for x in test_list if x % 3 == 0]
print("{}".format(test_list))
print(
"Числа которие делятся на 3 без остатка {}, количиство чисел {}".format(
new_list, len(new_list)))
second_func(12)
def third_func(n):
s = 0
while int(n) > 0:
a = n % 10
n = n // 10
s += a
return s
print(third_func(5145))