0 out of 464 challenges solved
Write a Python function `replace_specialchar` that takes a string as input and replaces all occurrences of spaces (`' '`), commas (`','`), or dots (`'.'`) with a colon (`':'`).
#### Example Usage
```python [main.nopy]
replace_specialchar("Python language, Programming language.")
# Expected output: "Python:language::Programming:language:"
replace_specialchar("a b c,d e f")
# Expected output: "a:b:c:d:e:f"
replace_specialchar("ram reshma,ram rahim")
# Expected output: "ram:reshma:ram:rahim"
```
#### Constraints
- The input string may contain any printable characters.
- The function should handle empty strings gracefully.import re
def replace_specialchar(text):
"""
Replace all occurrences of spaces, commas, or dots in the input text with a colon.
Args:
text (str): The input string.
Returns:
str: The modified string with specified characters replaced by colons.
"""
# Use a regular expression to find and replace the specified characters
pass # Replace this with the implementation