Verifique se uma string contém espaços

Published by Helen Yu in

Crie uma função que retorne True se uma string contiver algum espaço.

Exemplos

has_spaces("hello") ➞ False

has_spaces("hello, world") ➞ True

has_spaces(" ") ➞ True

has_spaces("") ➞ False

has_spaces(",./!@#") ➞ False

Notas

  • Uma string vazia não contém espaços.
  • Tente fazer isso sem expressões regulares.