Created
August 1, 2020 06:14
-
-
Save sohanmanju/da8d3f0d22101bc858f48780f2f8978f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
numbers = map(int, input("Please Enter any Numbers: ").split(",")) | |
def isEqualFactors(N): | |
ev_count = 0 | |
od_count = 0 | |
for i in range(1, (int)(math.sqrt(N)) + 2): | |
if N % i == 0: | |
if i == N // i: | |
if i % 2 == 0: | |
ev_count += 1 | |
else: | |
od_count += 1 | |
else: | |
if i % 2 == 0: | |
ev_count += 1 | |
else: | |
od_count += 1 | |
if (N // i) % 2 == 0: | |
ev_count += 1 | |
else: | |
od_count += 1 | |
if ev_count == od_count: | |
return True | |
return False | |
def print_factors(x): | |
print("The factors of", x, "are:") | |
for i in range(1, x + 1): | |
if x % i == 0: | |
print(i) | |
for number in numbers: | |
if isEqualFactors(number): | |
print_factors(number) | |
print("Yes, it has equal number of odd and even factors and the product is good!") | |
else: | |
print(number) | |
print(" Nope, the product is not good") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment