7 kyu

Replace all items

155 of 3,726wichu

Description:

Write function replaceAll (Python: replace_all) that will replace all occurrences of an item with another.

Python / JavaScript: The function has to work for strings and lists.

Example: replaceAll [1,2,2] 1 2 -> in list [1,2,2] we replace 1 with 2 to get new list [2,2,2]

replaceAll(replaceAll(array: [1,2,2], old: 1, new: 2) // [2,2,2]
Fundamentals
Arrays
Lists
Regular Expressions

Similar Kata:

Stats:

CreatedAug 12, 2016
PublishedAug 12, 2016
Warriors Trained6203
Total Skips398
Total Code Submissions19085
Total Times Completed3726
Haskell Completions155
Python Completions1235
F# Completions118
JavaScript Completions1060
C Completions406
Swift Completions760
Rust Completions131
Total Stars50
% of votes with a positive feedback rating88% of 690
Total "Very Satisfied" Votes550
Total "Somewhat Satisfied" Votes111
Total "Not Satisfied" Votes29
Total Rank Assessments19
Average Assessed Rank
7 kyu
Highest Assessed Rank
6 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • wichu Avatar
  • suic Avatar
  • imjasonmiller Avatar
  • wneumann Avatar
  • nomennescio Avatar
  • Voile Avatar
  • Souzooka Avatar
  • trashy_incel Avatar
  • farhanaditya Avatar
  • saudiGuy Avatar
Ad