Напишите программу, которая проверит, что число является совершенным. Совершенное число - натуральное число, равное сумме всех своих собственных делителей. Например, число 6 равно сумме своих собственных делителей 1 + 2 + 3.
Примеры совершенных чисел:
6, 28, 496, 8128
Решение:
def get_divisors(num): divisors = [] for i in range(1, num): if num % i == 0: divisors.append(i) return divisors
def perfect_num(num): divisors = get_divisors(num) return num == sum(divisors)
Напишите программу, которая проверит, что число является совершенным. Совершенное число - натуральное число, равное сумме всех своих собственных делителей. Например, число 6 равно сумме своих собственных делителей 1 + 2 + 3.
Примеры совершенных чисел:
6, 28, 496, 8128
Решение:
def get_divisors(num): divisors = [] for i in range(1, num): if num % i == 0: divisors.append(i) return divisors
def perfect_num(num): divisors = get_divisors(num) return num == sum(divisors)
A Telegram spokesman declined to comment on the bond issue or the amount of the debt the company has due. The spokesman said Telegram’s equipment and bandwidth costs are growing because it has consistently posted more than 40% year-to-year growth in users.
What is Secret Chats of Telegram
Secret Chats are one of the service’s additional security features; it allows messages to be sent with client-to-client encryption. This setup means that, unlike regular messages, these secret messages can only be accessed from the device’s that initiated and accepted the chat. Additionally, Telegram notes that secret chats leave no trace on the company’s services and offer a self-destruct timer.
Python Turbo Уютное сообщество Python разработчиков from id