Last active
December 2, 2018 16:48
-
-
Save alexandersazonof/0a508b3d0571ca0ccf6a47777023837f 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
#Дан целочисленный массив. Заменить все положительные элементы на значение минимального. | |
number_array = [-1, 4, 5, -2, -5, 4] | |
min_value_from_array = number_array.min | |
number_array = number_array.map { |e| e > 0 ? e = min_value_from_array : e } | |
puts number_array |
aya-soft
commented
Dec 2, 2018
- digital - это цифровой, а не содержащий числа
- пробелы отсутствуют во многих местах: { |e| e>0 ? e=min_value_from_array : e }
- digital - это цифровой, а не содержащий числа
- пробелы отсутствуют во многих местах: { |e| e>0 ? e=min_value_from_array : e }
1 изменил на number_array
2 я понял проблему
🥇
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment