7 kyu

Array Info

285 of 482user2821739

Description:

Brief

Sometimes we need information about the list/arrays we're dealing with. You'll have to write such a function in this kata. Your function must provide the following informations:

  • Length of the array
  • Number of integer items in the array
  • Number of float items in the array
  • Number of string character items in the array
  • Number of whitespace items in the array

The informations will be supplied in arrays that are items of another array. Like below:

Output array = [[array length],[no of integer items],[no of float items],[no of string chars items],[no of whitespace items]]

Added Difficulty

If any item count in the array is zero, you'll have to replace it with a None/nil/null value (according to the language). And of course, if the array is empty then return 'Nothing in the array!. For the sake of simplicity, let's just suppose that there are no nested structures.
Output ====== If you're head is spinning (just kidding!) then these examples will help you out-

   
array_info([1,2,3.33,4,5.01,'bass','kick',' '])--------->[[8],[3],[2],[2],[1]]    
array_info([0.001,2,' '])------------------------------>[[3],[1],[1],[None],[1]]   
array_info([])----------------------------------------->'Nothing in the array!'
array_info([' '])-------------------------------------->[[1],[None],[None],[None],[1]]
  

Remarks

The input will always be arrays/lists. So no need to check the inputs.
Hint ==== See the tags!!!
Now let's get going !

Arrays
Fundamentals

More By Author:

Check out these other kata created by user2821739

Stats:

CreatedOct 2, 2016
PublishedOct 2, 2016
Warriors Trained738
Total Skips14
Total Code Submissions1498
Total Times Completed482
Python Completions285
JavaScript Completions178
Ruby Completions48
Total Stars11
% of votes with a positive feedback rating69% of 161
Total "Very Satisfied" Votes94
Total "Somewhat Satisfied" Votes34
Total "Not Satisfied" Votes33
Total Rank Assessments9
Average Assessed Rank
7 kyu
Highest Assessed Rank
7 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • user2821739 Avatar
  • GiacomoSorbi Avatar
  • suic Avatar
Ad