Print the odd and even factors of a number in Python

+2 votes
I have a number, I want to print the factors of it but that's very easy

I want to distinguish between the odd and even factors.

eg:

10
The factors of 10 are:
1  Odd
2  Even
5  Odd
10  Even
Nov 19, 2018 in Python by Jino
• 5,570 points
1,210 views

1 answer to this question.

+3 votes
x = int(input("Enter any number \n"))
print("The factors of",x,"are:")
for i in range(1, x + 1):
    if x % i == 0:
        if i % 2 == 0:
            print(i," Even")
        else:
            print(i," Odd")
answered Nov 19, 2018 by Nabarupa
Master Kill!!!! Edureka rocks!!

Related Questions In Python

0 votes
2 answers
0 votes
1 answer
0 votes
1 answer

How can I find the square of a number in python?

You can use the exponentiation operator or ...READ MORE

answered May 20 in Python by Mohammad
• 3,170 points
48 views
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6 in Python by Neha
• 330 points

edited Jul 8 by Kalgi 409 views
+4 votes
6 answers
0 votes
1 answer

Can someone explain the behaviour of increment and decrement operators in python

down voteaccepted ++ is not an operator. It is ...READ MORE

answered May 15, 2018 in Python by ariaholic
• 7,340 points
480 views
0 votes
1 answer

How do you get the logical xor of two variables in Python?

If you're already normalizing the inputs to ...READ MORE

answered May 29, 2018 in Python by ariaholic
• 7,340 points
4,265 views