/ Published in: Python

Contador de palabras en la input.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
ejecutar = True while ejecutar: res = input('Escribe algo y aparecerá el número de palabras que hay ').strip() ls = [] for i in res: ls.append(i) espacios = ls.count(' ') print(espacios + 1) volver = input('Quieres volver a intentarlo? ') if volver.startswith('s'): ejecutar = True else: ejecutar = False
Comments
