Practice Challenge One

Coding Challenge Coding Live

: You did not mutate the original array!

o_args = deep_dup(args)!

ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-linux]

(returned, invocation, expectation)

returned == expectation && returned.

Define a method that returns the sum of all the non-negative integers up to and including its argument.

.send(method_name, *args) returned = prettify(returned) expectation = prettify(expectation) args_statement = format_args(args) invocation =

note_failure(returned, invocation, expectation)

] print_test(tested_method, args, expectation)

) ? identity_test(returned, invocation, expectation, args) : equality_test(returned, invocation, expectation)

Define a method, e_words(str), that accepts a string as an argument. Your method return the number of words in the string that end with the letter e.

el.is_a?(Array) ? acc deep_dup(el) : acc el

e_words(Let be be finale of seem.) = 3

By continuing, you agree to Repl.itsTerms of ServiceandPrivacy Policy, and to receiving emails with updates.

(returned, invocation, expectation, args)

A magic number is a number whose digits, when added together, sum to 7, e.g., 34. Define a method that returns an array of the first n magic numbers. You may wish to write a helper method (magic_number?) that returns a boolean indicating whether a number is magic. This problem is harder than anything youll receive on the coding assessment.

equality_test(returned, invocation, expectation)

method_name = method_name.to_s expectation = args[-

(returned, invocation, expectation)

(returned, invocation, expectation)

magic_numbers(3) = [7, 16, 25]

note_success(returned, invocation, expectation)

Leave a Reply