Last active
December 16, 2018 21:02
-
-
Save darya-makarenko/591b444b39e56cd4f1b333a7822f62d0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#gets the index of the biggest height and | |
#extracts the surname at this index | |
def get_surname_of_tallest(height_arr, surname_arr) | |
tallest_index = height_arr.index(height_arr.max) | |
surname_arr[tallest_index] | |
end | |
puts "Enter the heights of students" | |
heights = gets.chomp.split.map(&:to_i) | |
puts "Enter the surnames of students" | |
surnames = gets.chomp.split | |
puts "The tallest student is #{get_surname_of_tallest(heights, surnames)}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
🥇