from Nodos import * import math numeros = lista() while True: opciones() opcion = int(input('\n Selección: ')) if opcion == 1: #Agregar número print('\n Ingrese un número ') dato = int(input('\n > ')) numeros.bdi(dato) print(Fore.YELLOW+ f'''\n !El número {dato} fue agregado correctamente! '''+Style.RESET_ALL) elif opcion == 2: #Mostrar lista numeros.imprimirnodos() elif opcion == 3: #Mostrar promedio numeros.promedio() elif opcion == 4: #Mostrar mayor y menor numeros.mayorymenor() elif opcion == 5: #Eliminar número if numeros.vacia() is True: print(Fore.RED+'\n !Primero debe ingresar números!'+Style.RESET_ALL) else: numeros.imprimirnodos() print('\n ¿Qué número desea eliminar? ') n = int(input('\n > ')) numeros.bdb(n) elif opcion == 6: #Eliminar iguales if numeros.vacia() is True: print(Fore.RED+'\n !Primero debe ingresar números!'+Style.RESET_ALL) else: numeros.imprimirnodos() print('\n ¿Qué números iguales desea eliminar? ') n = int(input('\n > ')) numeros.eliminariguales(n) elif opcion == 7: #Crear lista con cada dígito print('\n Ingrese un número hasta de 4 cifras ') n = int(input('\n > ')) if n <= 9999: d1=math.trunc (n/1000) d2=math.trunc (n/100) d2=d2%10 d3=math.trunc (n/10) d3=d3%10 d4= n % 10 if d1 > 0: numeros.bdi(d1) if d2 > 0: numeros.bdi(d2) if d3 > 0: numeros.bdi(d3) if d4 > 0: numeros.bdi(d4) print(Fore.YELLOW+ f'''\n !Se creó la lista con el número {n} correctamente! '''+Style.RESET_ALL) else: print(Fore.RED+'\n !El número debe ser hasta 04 digitos!'+Style.RESET_ALL) elif opcion == 8: #salir print(Fore.YELLOW+ f'''\n !Hasta pronto! '''+Style.RESET_ALL) exit() elif opcion < 1 or opcion > 8: print(Fore.RED+'\n Opción invalida, intente nuevamente.'+Style.RESET_ALL)