Print the odd and even factors of a number in Python

+1 vote
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,520 points
107 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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")
answered Nov 19, 2018 by Nabarupa

Related Questions In Python

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 8 hours ago in Python by Mohammad
• 1,400 points
6 views
+1 vote
4 answers

Count the frequency of an item in a python list

To count the number of appearances: from collections ...READ MORE

answered Oct 18, 2018 in Python by tinitales
64 views
0 votes
1 answer

how can i count the items in a list?

suppose you have a list a = [0,1,2,3,4,5,6,7,8,9,10] now ...READ MORE

answered May 2 in Python by Mohammad
• 1,400 points
19 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,320 points
196 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,320 points
773 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.