Last active
November 22, 2018 20:58
-
-
Save mikalai-yankouski/b5c030ca4ff656c0ce76d71b1ef2d023 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
require 'faker' | |
def random_names(n) | |
Array.new(n) { Faker::Name.unique.name } | |
end | |
students = random_names(10) | |
height_of_students = (150..200).to_a.sample(10) | |
highest_i = height_of_students.index(height_of_students.max) | |
puts "The highest student is #{students[highest_i]}, with height: #{height_of_students[highest_i]} cm" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
🥇