7 kyu

Predict your age!

1,022 of 24,339Torkel

Description:

My grandfather always predicted how old people would get, and right before he passed away he revealed his secret!

In honor of my grandfather's memory we will write a function using his formula!

  • Take a list of ages when each of your great-grandparent died.
  • Multiply each number by itself.
  • Add them all together.
  • Take the square root of the result.
  • Divide by two.

Example

predictAge(65, 60, 75, 55, 60, 63, 64, 45) === 86
predict_age(65, 60, 75, 55, 60, 63, 64, 45) == 86
predict_age(65, 60, 75, 55, 60, 63, 64, 45) == 86
predict_age(65, 60, 75, 55, 60, 63, 64, 45) == 86
predict_age(65, 60, 75, 55, 60, 63, 64, 45) == 86
predictAge(65, 60, 75, 55, 60, 63, 64, 45) == 86
predictAge(65, 60, 75, 55, 60, 63, 64, 45) == 86
predictAge(65, 60, 75, 55, 60, 63, 64, 45) == 86
Predicter.predictAge(65, 60, 75, 55, 60, 63, 64, 45) == 86

Note: the result should be rounded down to the nearest integer.

Some random tests might fail due to a bug in the JavaScript implementation. Simply resubmit if that happens to you.

Fundamentals

Similar Kata:

Stats:

CreatedMay 18, 2018
PublishedMay 18, 2018
Warriors Trained34922
Total Skips4045
Total Code Submissions58455
Total Times Completed24339
JavaScript Completions7751
Python Completions6392
Ruby Completions634
Clojure Completions167
C++ Completions1792
CoffeeScript Completions18
Julia Completions154
Groovy Completions69
Java Completions2513
PHP Completions748
Kotlin Completions1022
C# Completions939
R Completions228
Lua Completions308
F# Completions102
C Completions746
NASM Completions17
Crystal Completions25
TypeScript Completions508
Scala Completions293
Dart Completions705
Total Stars245
% of votes with a positive feedback rating85% of 2841
Total "Very Satisfied" Votes2162
Total "Somewhat Satisfied" Votes523
Total "Not Satisfied" Votes156
Total Rank Assessments5
Average Assessed Rank
7 kyu
Highest Assessed Rank
7 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • Torkel Avatar
  • anter69 Avatar
  • kazk Avatar
  • JohanWiltink Avatar
  • Blind4Basics Avatar
  • Souzooka Avatar
  • FArekkusu Avatar
  • KDaryl Avatar
  • hobovsky Avatar
  • FiveCrayFish973 Avatar
  • ejini战神 Avatar
  • KayleighWasTaken Avatar
Ad