teslariu

input nombre

Jan 12th, 2022
971
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.34 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. #
  4. """
  5. Pedir por teclado el nombre de usuario, si está vacío, volver a pedirlo
  6. hasta que se ingrese un nombre. Luego, saludar al usuario.
  7. """
  8. while True:
  9.     nombre = input("Ingrese su nombre: ")
  10.     # strip borra los espacios vacios
  11.     if nombre.strip():
  12.         print(f"Hola {nombre.strip()}")
  13.         break
Advertisement
Add Comment
Please, Sign In to add comment