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 trialOmar Farag
4,573 PointsThe Mod method could not be found
I put in this code but it doesn't seem to work
def mod(a, b)
a % b = c
return "The remainder of #{a} divided by #{b} is #{c}"
end
11 Answers
Luis Henrique Witz
16,505 PointsIt should't be?
def mod(a, b)
c = a % b
return "The remainder of #{a} divided by #{b} is #{c}"
end
alastair cooper
30,617 PointsI think it is not compiled because you have % instead of /.
not sure though
Omar Farag
4,573 PointsIm supposed to find the remainder so...
alastair cooper
30,617 Pointssorry... not paying attention
Omar Farag
4,573 PointsWouldn't that be the same thing? Anyways, I'll try it out. Thanks
Luis Henrique Witz
16,505 PointsWhat's the error?
Omar Farag
4,573 PointsBummer! The mod method could not be found.
Luis Henrique Witz
16,505 PointsWeird. When I run the code in the challenge it passes. You are running locally?
Omar Farag
4,573 PointsLocally?
Omar Farag
4,573 PointsWould you mind posting the code you ran?
Luis Henrique Witz
16,505 PointsSure my friend. It's the same that I posted first:
def mod(a, b)
c = a % b
return "The remainder of #{a} divided by #{b} is #{c}"
end
Omar Farag
4,573 PointsAnother Error is: Bummer! NameError: undefined local variable or method `c' for main:Object
With this code:
def mod(a, b)
a % b = c
return "The remainder of #{a} divided by #{b} is #{c}"
end
Omar Farag
4,573 Pointsdef mod(a, b) a % b = c return "The remainder of #{a} divided by #{b} is #{c}" end
Omar Farag
4,573 PointsThat code gives me this error: Bummer! Something doesn't look quite right. Double check your spelling and punctuation.
Luis Henrique Witz
16,505 PointsSorry. The challenge need's of the pontuaction at the end :)
def mod(a, b)
c = a % b
return "The remainder of #{a} divided by #{b} is #{c}."
end
Omar Farag
4,573 PointsLets hope that's not what I was stuck on for 3 hours...
Omar Farag
4,573 PointsLol. That was what I was stuck on for 3 hours! Thanks man! You really helped me out!
oluwole oyekanmi
286 PointsThanks Luis.. I was stuck on this for two days.. ugh
Omar Farag
4,573 PointsOmar Farag
4,573 PointsNope, doesn't work