Напишите программу, которая проверит, что число является совершенным. Совершенное число - натуральное число, равное сумме всех своих собственных делителей. Например, число 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)
But a Telegram statement also said: "Any requests related to political censorship or limiting human rights such as the rights to free speech or assembly are not and will not be considered." To delete a channel with over 1,000 subscribers, you need to contact user support The court said the defendant had also incited people to commit public nuisance, with messages calling on them to take part in rallies and demonstrations including at Hong Kong International Airport, to block roads and to paralyse the public transportation system. Various forms of protest promoted on the messaging platform included general strikes, lunchtime protests and silent sit-ins. Commenting about the court's concerns about the spread of false information related to the elections, Minister Fachin noted Brazil is "facing circumstances that could put Brazil's democracy at risk." During the meeting, the information technology secretary at the TSE, Julio Valente, put forward a list of requests the court believes will disinformation. Joined by Telegram's representative in Brazil, Alan Campos, Perekopsky noted the platform was unable to cater to some of the TSE requests due to the company's operational setup. But Perekopsky added that these requests could be studied for future implementation.
from us