Print the odd and even factors of a number in Python

+4 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,810 points
16,363 views

1 answer to this question.

0 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")

Hope this will help!

To learn more, go for Python Master course today.

Thank!

answered Nov 19, 2018 by Nabarupa
Master Kill!!!! Edureka rocks!!

Related Questions In Python

0 votes
1 answer

How to find the value of a row in a csv file in python and print column and row of that value ?

Hello @Khanhh , Use panda to find the value of ...READ MORE

answered Oct 15, 2020 in Python by Niroj
• 82,880 points
6,197 views
–1 vote
2 answers
+1 vote
1 answer
0 votes
2 answers
+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 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,023 views
0 votes
1 answer
+5 votes
6 answers

Lowercase in Python

You can simply the built-in function in ...READ MORE

answered Apr 11, 2018 in Python by hemant
• 5,790 points
3,418 views
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 aryya
• 7,450 points
1,498 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 aryya
• 7,450 points
10,445 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP