Question 4 Arrays Collections Manipulations | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Question 4 Arrays Collections Manipulations

Hi, Correspondingly, can someone please answer question number 4. Thanks!

4th Nov 2016, 9:17 AM
Miles Griffith
Miles Griffith - avatar
3 Answers
+ 2
Ok, so first, add "z" to the array: arr << "z" next, remove all duplicates: arr.uniq! finally, output the number of its elements: puts arr.size Hope this helped
4th Nov 2016, 3:20 PM
Andre Burte
Andre Burte - avatar
+ 1
Hi Miles! I'll try to help, just post the question, if you can, please.
4th Nov 2016, 2:35 PM
Andre Burte
Andre Burte - avatar
0
Here's the question to number 4: Fill in the blanks to add "z" to the array, remove all duplicates, and output the number of its elements. arr = ["a", "b", "a"] << "z" arr. puts arr. size remove freeze uniq! arr
4th Nov 2016, 2:59 PM
Miles Griffith
Miles Griffith - avatar