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 trialTina Maddox
28,102 PointsWon't run for challenge but runs in workspaces
My code runs in workspaces/console but states something isn't quite right. Does anyone else see what I am missing?
Tina Maddox
28,102 Pointsdef mod(a, b)
#write your code here
c = a % b
return "The remainder of #{a} divided by #{b} is: #{c}"
end
puts mod(5, 5)
2 Answers
Jason Anello
Courses Plus Student 94,610 PointsThe code challenge is looking for an exact match on the output string. What you have isn't wrong but not exactly what the code challenge is expecting to get.
The example string has a period at the end which you need to add and you have to take out the colon that you added after "is"
Jason Anello
Courses Plus Student 94,610 PointsAlso, you don't necessarily need to create the extra variable c
but it doesn't hurt to do so. You could place the a % b
expression directly in the output string.
return "The remainder of #{a} divided by #{b} is #{a % b}."
Tina Maddox
28,102 PointsJason,
Thank you! That was driving me nuts. I couldn't figure out what it wanted.
I apologize for not putting my code in earlier. I thought I had. Multi-tasking doesn't go so well sometimes.
I appreciate your informative feedback. :)
Jason Anello
Courses Plus Student 94,610 PointsJason Anello
Courses Plus Student 94,610 PointsHi Tina,
Can you post your code?