Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Ruby Ruby Basics Numbers Math Operations

Ronald Greer
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Ronald Greer
Front End Web Development Techdegree Graduate 56,280 Points

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
216,012 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