Login and get coding
For this bite you are going to solve three different tasks, where each task becomes progressively more complicated.
reregular expression (RegEx) package from the beginning, as it should help you solve the final task.
For the purposes of this bite, a character refers to a unicode-character and is not limited to alphanumeric symbols!
The goal of
count_n_repetitionsis to count how often characters are followed by themselves for n times. A repetition of a character refers to a sequence of the same character, which is not interrupted by a different character:
AABA: A is repeated once after the first A.
The second function,
count_n_reps_or_chars_followingshould count how often characters are repeated for n times, or followed by the given input character n times. If
charis also followed by itself it only counts once.
The final function,
check_surrounding_chars, should count the number of times a character is surrounded by characters from the given
To see a couple of example inputs and outputs, look at this document.
We assume all inputs use the correct types and valid values. You only need to focus on the regular expression. :)
Hint To quickly test out regular expression, websites like regex101 can help a lot (don't forget to set the RegEx flavor to Python).
49 out of 54 users completed this Bite.
Will you be Pythonista #50 to crack this Bite?
Resolution time: ~115 min. (avg. submissions of 5-240 min.)
Pythonistas rate this Bite 7.67 on a 1-10 difficulty scale.
» Up for a challenge? 💪