This forum is now read-only. Please use our new forums! Go to forums
I have no idea what is wrong and the hint is no help.
Here is what I was asked to do: Define two methods in the editor:
A greeter method that takes a single string parameter, name, and returns a string greeting that person. (Make sure to use return and don’t use print or puts.) A by_three? method that takes a single integer parameter, number, and returns true if that number is evenly divisible by three and false if not.
Here is what I wrote def greeter(name) return “Hello to” + [name] + “.” end
def by_three?(number) return number % 3 == 0 end
greeter(marie)
What did I do wrong? ?????
thanks
Answer 558254e19113cb010b000017
0 votes
It seems like string “name” in [], try to put it into ().
Answer 55a675d99376766f4300018a
0 votes
Use this code.
def greeter(name)
return "hi" + name
end
def by_three?(number)
if number%3 == 0
return true
else
return false
end
end
Popular free courses
- Free Course
Learn SQL
In this SQL course, you'll learn how to manage large datasets and analyze real data using the standard data management language.Beginner friendly,4 LessonsLanguage Fluency - Free Course
Learn JavaScript
Learn how to use JavaScript — a powerful and flexible programming language for adding website interactivity.Beginner friendly,11 LessonsLanguage Fluency - Free Course
Learn HTML
Start at the beginning by learning HTML basics — an important foundation for building and editing web pages.Beginner friendly,6 LessonsLanguage Fluency
1 comments
by_three is supposed to return “true” if it’s divisible by 3, not return the number divisible by 3. Needs to be an if/else statement. Stuck on that myself though.