fork download
  1. def valida(texto):
  2. partes = texto.split(' - ')
  3. return len(partes) == 3 and all(len(parte) > 0 for parte in partes)
  4.  
  5. print(valida('abc - xyz - 123')) # True
  6. print(valida('abc - xyz - 123 - a')) # False
  7.  
Success #stdin #stdout 0.02s 9216KB
stdin
Standard input is empty
stdout
True
False