Delete repeated characters¶
Write the function
delete_repeated()that takes a string, and returns another string where all the repeated characters in the first string have been deleted.Save this function into file
delete_repeated1.py. Examples:>>> delete_repeated('La Gemma te disset anys...') 'La Gemtdisny.' >>> delete_repeated('abcca sse--aabbbbe--1244') 'abc se-124'
Note
More tests are provided in file
test-delete1.txtSolution
A solution of these functions is provided in file
delete_repeated1.pyWrite the function
delete_repeated_cons()that takes a string, and returns another string where only the repeated consecutive characters have been removed from the given string.Save the function into file
delete_repeated2.py. Examples:>>> delete_repeated_cons('La Gemma te disset anys...') 'La Gema te diset anys.' >>> delete_repeated_cons('abcca sse--aabbbbe--1244') 'abca se-abe-124'
Note
More tests are provided in file
test-delete2.txtSolution
A solution of these functions is provided in files
delete_repeated2.py