program takes 2 integers and then finds how many divisors each integer between the original 2 has. then prints out which number has the highest number of divisors.

any help is appreciated. im just starting to learn this stuff

Recommended Answers

All 6 Replies

well first of all you need to think out how it should work. So, mathematically how do you find the divisors of a number? Then how would you say that in Python? Effort in effort out around here.

commented: Proper newbie handling, sensei ;) +13

days later and i am still stuck on this...

i know i need to use % when doing the divisors but the % confuses me. what is the exact purpose of the %

i got it to take 2 integers and print them as well as all the integers in between...now im just having trouble putting in to see how many divisors each integer has

HINT: % is the shows the remainder so:

>>>2%2
0
>>>9%2
1

so if a number IN THE RANGE OF 1 AND THE GIVEN NUMBER!!!! had a remainder of 1, would it be a divisor? How about if it had a remainder of 0? Now if we wanted to just find out the amount of divisors it had how would we do that? HINT#2: This is likely to be the LENgth of something.

You can also use divmod.

whole, remain = divmod(11, 3)
print whole, remain

You could also be looking prime factors instead of divisor. Prime factors of 12 are 2, 2 and 3, divisors are 1, 2, 4, 6 and 12. You must be clear what is the request.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.