Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- nombres = ["hola","como","estas","chucho","puto","chupala","amigo","tito","pobre","chabon","zapallo"]
- def elegir_producto(nombres):
- while True:
- mostrar_productos(5,nombres)
- def mostrar_productos(cantidad_muestra,nombres):
- for numero,producto in enumerate( nombres[:cantidad_muestra],1):
- print("{} : {} ".format(numero,producto))
- seleccion = input("Ingrese el numero del producto que desea, si no esta en la lista ponga \"*\" ")
- if len(seleccion) == 1 and seleccion.isdigit():
- seleccion = int(seleccion)
- return nombres[seleccion-1]
- elif seleccion == "*":
- nombres = nombres[cantidad_muestra::]
- if nombres[:cantidad_muestra] == []:
- print("No se encontraron mas productos. Volviendo al menu principal.")
- return ""
- else:
- return mostrar_productos(cantidad_muestra,nombres)
- print(mostrar_productos(5,nombres))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement