Valid Spacing in codewars using python

Shashivardhan
May 2, 2021

Write a python function called valid_spacing() or validSpacing() which checks if a string has valid spacing. The function should return either True or False.

Syntax for valid spacing is one space between words, and no leading or trailing spaces.Some examples of what the function should return.

https://www.codewars.com/kata/5f77d62851f6bc0033616bd8/train/python

Check if s starts with a space or s ends with space ,if a space is found ‘False’ is returned.

Finally if double space if found return False else return True

Originally published at https://onlylang.blogspot.com on May 2, 2021.

--

--