Hackerrank - Re.split() Solution
1 min read

Hackerrank - Re.split() Solution

Hackerrank - Re.split() Solution

Check Tutorial tab to know how to to solve.

You are given a string  consisting only of digits 0-9, commas ,, and dots .

Your task is to complete the regex_pattern defined below, which will be used to re.split() all of the , and . symbols in .

It’s guaranteed that every comma and every dot in  is preceeded and followed by a digit.

Sample Input 0


Sample Output 0


Solution in Python

regex_pattern = r"[.,]"	
import re
print("\n".join(re.split(regex_pattern, input())))

Enjoying these posts? Subscribe for more

Adblocker detected! Please consider reading this notice.

We've detected that you are using AdBlock Plus or some other adblocking software which is preventing the page from fully loading.

That's okay. But without advertising-income, we can't keep making this site awesome.

We don't have any banner, Flash, animation, obnoxious sound, or popup ad. We do not implement these annoying types of ads!

We need money to operate the site, and almost all of it comes from our online advertising.

Please add thepoorcoder.com to your ad blocking whitelist or disable your adblocking software.