7 kyu

List Filtering

123,385 of 301,140cmgerber

Description:

In this kata you will create a function that takes a list of non-negative integers and strings and returns a new list with the strings filtered out.

Example

filter_list([1,2,'a','b']) == [1,2]
filter_list([1,'a','b',0,15]) == [1,0,15]
filter_list([1,2,'aasf','1','123',123]) == [1,2,123]
ListFilterer.GetIntegersFromList(new List<object>(){1, 2, "a", "b"}) => {1, 2}
ListFilterer.GetIntegersFromList(new List<object>(){1, "a", "b", 0, 15}) => {1, 0, 15}
ListFilterer.GetIntegersFromList(new List<object>(){1, 2, "a", "b", "aasf", "1", "123", 123}) => {1, 2, 231}
{ 1 2 "a" "b" } filter-seq ! { 1 2 }
{ 1 "a" "b" 0 15 } filter-seq ! { 1 0 15 }
{ 1 2 "aasf" "1" "123" 123 } filter-seq ! { 1 2 123 }
Kata.filterList(List.of(1, 2, "a", "b")) => List.of(1,2)
Kata.filterList(List.of(1, "a", "b", 0, 15)) => List.of(1,0,15)
Kata.filterList(List.of(1, 2, "a", "b", "aasf", "1", "123", 123)) => List.of(1, 2, 123)
filterList(List(1, 2, "a", "b")) == List(1, 2)
filterList(List(1, "a", "b", 0, 15)) == List(1, 0, 15)
filterList(List(1, 2, "aasf", "1", "123", 123)) == List(1, 2, 123)
filterList(ListOf(1, 2, "a", "b")) == [1, 2]
filterList(ListOf(1, "a", "b", 0, 15)) == [1, 0, 15]
filterList(ListOf(1, 2, "a", "b", "aasf", "1", "123", 123)) == [1, 2, 123]
Lists
Filtering
Data Structures
Fundamentals

Stats:

CreatedAug 1, 2014
PublishedAug 1, 2014
Warriors Trained486246
Total Skips35386
Total Code Submissions700739
Total Times Completed301140
Python Completions123385
Ruby Completions10166
CoffeeScript Completions315
JavaScript Completions142210
C# Completions15390
F# Completions164
Java Completions11638
Factor Completions27
Scala Completions260
Kotlin Completions888
Lua Completions105
TypeScript Completions1174
Total Stars2000
% of votes with a positive feedback rating90% of 22317
Total "Very Satisfied" Votes18064
Total "Somewhat Satisfied" Votes3872
Total "Not Satisfied" Votes381
Ad
Contributors
  • cmgerber Avatar
  • jhoffner Avatar
  • xcthulhu Avatar
  • user578387 Avatar
  • ccondie Avatar
  • dinglemouse Avatar
  • Chrono79 Avatar
  • Ze-Marcos Avatar
  • Blind4Basics Avatar
  • nomennescio Avatar
  • Madjosz Avatar
  • Souzooka Avatar
  • eb110 Avatar
  • monadius Avatar
  • hobovsky Avatar
  • xavierguihot Avatar
  • Glyxerine Avatar
  • ejini战神 Avatar
  • user2058606 Avatar
  • Wisdou Avatar
  • Kacarott Avatar
  • sid114 Avatar
  • airshawn Avatar
  • KayleighWasTaken Avatar
  • metatable Avatar
  • JavaScripts Avatar
Ad