5 kyu

Exponent method

1,312 of 1,331craecke

Description:

Create a method called "power" that takes two integers and returns the value of the first argument raised to the power of the second. Return nil if the second argument is negative.

Note: The ** operator has been disabled.

Examples:

  • power(2, 3) # 8
  • power(10, 0) # 1
  • power(-5, 3) # -125
  • power(-4, 2) # 16
Mathematics
Algorithms

Similar Kata:

Stats:

CreatedOct 6, 2013
PublishedOct 6, 2013
Warriors Trained1764
Total Skips129
Total Code Submissions7454
Total Times Completed1331
Ruby Completions1312
Total Stars13
% of votes with a positive feedback rating83% of 99
Total "Very Satisfied" Votes72
Total "Somewhat Satisfied" Votes21
Total "Not Satisfied" Votes6
Total Rank Assessments6
Average Assessed Rank
5 kyu
Highest Assessed Rank
1 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • craecke Avatar
  • jhoffner Avatar
  • cliffstamp Avatar
  • Just4FunCoder Avatar
Ad