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 trialDavid Thrower
6,693 PointsFor some reason, this won't take the solution I made, yet it seems correct.
I defined a method that should do what the challenge asks for. I also tested it by adding the line of code:
mod(7,3)
... and it said what it was supposed to say.
def mod(a, b)
# get the remainder of a/b and assign it to C
c=a%b
puts "The remainder of #{a} divided by #{b} is #{c}."
end
3 Answers
Shawn Wilson
iOS Development Techdegree Student 7,049 PointsDavid, Try clearing you browsing history, close your browser and try again, I have had these issues in the past as well and that was what resolved it for me. Let me know how it works for you, even try a computer restart after clearing your browser.
Simon Coates
28,694 Pointsit seemed to accept
def mod(a, b)
# get the remainder of a/b and assign it to C
c=a%b
return "The remainder of #{a} divided by #{b} is #{c}."
end
By return they meant send back, not output to screen.
David Thrower
6,693 PointsSomething must be wrong. It is rejecting my answer. I am having a similar problem on a code challenge in my JavaScript class as well.
Simon Coates
28,694 Pointsi just copied my code from above and repasted. Passed challenge. Unsure why this wouldn't work for you.
Jason Anders
Treehouse Moderator 145,860 PointsI also copy/pasted Simon Coates answer into the challenge and also passed. So, it should work.