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 Modules Ruby Core Modules Math

Using the sqrt method in the Math module, assign the value of the square root of 9 to the variable @sqrt.

This should be very simple!

Math::E = @e Math::PI = @PI

I set these variables to these values and the code is accepted, but when I input

Math.sqrt(9) = @sqrt

it says Task 1 is no longer passing. I feel like this should be so easy, so I'm not sure what to do now.

Thanks!

math.rb
@pi = nil
@e  = nil
@sqrt = nil
Math::E = @e
Math::PI = @PI
Math.sqrt(9) = @sqrt

8 Answers

Lukas Jones
Lukas Jones
11,667 Points

I would flip your variable assignments so they look like this

@e = Math::E 
@PI = Math::PI
@sqrt = Math.sqrt(9)
jonathan kennedy
PLUS
jonathan kennedy
Courses Plus Student 9,251 Points

Ive tried this every which way and it does not work?????

@sqrt = Math.sqrt(9)
Math.sqrt(9) = @sqrt 

either was should work?????

Michael Jasinski
Michael Jasinski
7,427 Points

I have @sqrt = Math.sqrt(9) exactly and will not pass. Just a buggy system!

Has anyone passed this Task yet? I have tried everything and either task one is no longer passing or the @sqrt variable did not have the correct value.

MICHAEL P
MICHAEL P
5,191 Points

This ends up working:

@sqrt = Math.sqrt(9)

start again from the 1-st task - it will work

That's funny ! I have the same problem now and I don't know to how figure out this ,,,

@pi = nil
@e  = nil
@sqrt = nil
module Math
  Math::E = @e
  Math::PI = @PI
  Math.sqrt(9) = @sqrt
end
@pi = nil
@e  = nil
@sqrt = nil

Math::E = @e
Math::PI = @pi
@sqrt = Math.sqrt(9)