Re.split() in python - hackerrank solution
Problem :
The re.split() expression splits the string by occurrence of a pattern.
>>> import re >>> re.split(r"-","+91-011-2711-1111") ['+91', '011', '2711', '1111']
Your task is to complete the regex_pattern defined below, which will be used to re.split() all of the , and . symbols in s.
It’s guaranteed that every comma and every dot in s is preceeded and followed
by a digit.
Sample Input :
100,000,000.000
Sample Output :
100 000 000 000
Solution :
1 2 3 4 5 6 7 | # Re.split() in python - hacker rank solution # Python 3 # Re.split() in python - hacker rank solution START regex_pattern = r"[.,]+" # Do not delete 'r'. # Re.split() in python - hacker rank solution END import re print("\n".join(re.split(regex_pattern, input()))) |
Disclaimer :-
the above hole problem statement is given by hackerrank.com but the solution is generated by the codeworld19 authority if any of the query regarding this post or website fill the following contact form thank you.