0 out of 464 challenges solved

Replace Whitespace and Underscores

Write a Python function `replace_spaces` that takes a string as input and replaces all whitespaces (`' '`) with underscores (`'_'`) and all underscores (`'_'`) with whitespaces (`' '`). The function should return the modified string.

#### Example Usage
```python [main.nopy]
replace_spaces("Jumanji The Jungle")
# Output: "Jumanji_The_Jungle"

replace_spaces("The_Avengers")
# Output: "The Avengers"

replace_spaces("Fast and Furious")
# Output: "Fast_and_Furious"
```
def replace_spaces(text):
    """
    Replace whitespaces with underscores and underscores with whitespaces in the given string.

    Args:
        text (str): The input string.

    Returns:
        str: The modified string with whitespaces and underscores swapped.
    """
    # Implement the function logic here
    pass