Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python

not modulo but something else

for the value 7.6666, we called the int and it returned 7. The modulo returned 3. but say you only wanted to return .66666 part? what would I enter?

For example, 23/12 = 1.91666667 but I just want to return the .91666667? handy when working with degrees minutes and seconds.

1 Answer

Just take whatever answer you have and find modulo of 1:

7.6666 % 1 = .6666

1.91666667 % 1 = .91666667

There would be some rounding errors, for instance 1.91666667 % 1 would actually give you .9166666699999999 but I this is probably what you're looking for.