1.
number = int(input("> "))
divisors = 0
for i in range(1, number):
if number / i == int(number / i):
divisors += 1
if divisors == 2 or number == 1:
print("Число просте")
else:
print("Число не є простим")
2.
print(int(number / i))
3.
primfactors = []
d = 2
while d * d <= number:
if number % d == 0:
primfactors.append(str(d))
number //= d
d += 1
if number > 1:
primfactors.append(str(number))
print(', '.join(primfactors))
4.
text = input("> ")
print(text.swapcase())
5. Не зрозумів умову
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
1.
number = int(input("> "))
divisors = 0
for i in range(1, number):
if number / i == int(number / i):
divisors += 1
if divisors == 2 or number == 1:
print("Число просте")
else:
print("Число не є простим")
2.
number = int(input("> "))
for i in range(1, number):
if number / i == int(number / i):
print(int(number / i))
3.
number = int(input("> "))
primfactors = []
d = 2
while d * d <= number:
if number % d == 0:
primfactors.append(str(d))
number //= d
else:
d += 1
if number > 1:
primfactors.append(str(number))
print(', '.join(primfactors))
4.
text = input("> ")
print(text.swapcase())
5. Не зрозумів умову