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

Ruby Ruby Basics Numbers Math Operations

Ive been stuck on this ruby code challenge for a long time

I've never been able to figure out how to pass this code challenge, I've rewatched countless videos and i can't find anything on google. if anyone can please help, that'd be great.

program.rb

1 Answer

Steven Parker
Steven Parker
231,198 Points

The instructions say, "Multiply 25 times 3 and assign the result to a variable named product. Then divide 7 by 4 and assign the result to a variable named quotient."

So this is basically just two simple assignments with a calculation — the only trick to it is that to get a full-precision result, one of the values in the division needs to be specified as a float.

product = 25 * 3
quotient = 7.0 / 4    # note the explicit float