Post by mamun11 on May 15, 2024 21:26:45 GMT -7
append(num) return primos limite_superior = 100 primos_encontrados = encontrar_primos(limite_superior) print("Números primos encontrados:", primos_encontrados) With this, we enter the following prompt in Platzi bot: ¿Cuán eficiente es el siguiente código? ¿Cómo lo puedo mejorar? def es_primo(numero): if numero <= 1: return False for i in range(2, numero): if numero % i == 0: return False return True def encontrar_primos(limit): primos = for num in range(2, limit): if es_primo(num): primos.append(num) return primos limite_superior = 100 primos_encontrados = encontrar_primos(limite_superior) print("Números primos encontrados:", primos_encontrados) Then Platzi bot tells us: prompt-2.
png With this you can optimize not only simple Saint Helena Email List pieces of code, but larger projects that you are doing along the Platzi learning paths. 3. Stress-free code debugging It is very common that when developing software the code does not work at first and this can block our progress. . But with Platzi Bot you can save a lot of time, since you will not debug the code manually, but you will do it with artificial intelligence.
As an example, let's take the following Python code that has an error in the last line: def calcular_promedio(numeros): total = sum(numeros) promedio = total / len(numeros) return promedio numeros = 10, 20, 30, 40, 50 promedio = calcular_promedio(numeros) print("El promedio es:", promedio) print("La suma de los números es:", total) # Aquí hay un error In Platzi bot we put the following prompt: ¿Cuál es el error en el código? ¿Cómo lo puedo solucionar? def calcular_promedio(numeros): total = sum(numeros) promedio = total / len(numeros) return promedio numeros = 10, 20, 30, 40, 50 promedio = calcular_promedio(numeros) print("El promedio es:", promedio) print("La suma de los números es:", total) And in response we have: prompt-3.
png With this you can optimize not only simple Saint Helena Email List pieces of code, but larger projects that you are doing along the Platzi learning paths. 3. Stress-free code debugging It is very common that when developing software the code does not work at first and this can block our progress. . But with Platzi Bot you can save a lot of time, since you will not debug the code manually, but you will do it with artificial intelligence.
As an example, let's take the following Python code that has an error in the last line: def calcular_promedio(numeros): total = sum(numeros) promedio = total / len(numeros) return promedio numeros = 10, 20, 30, 40, 50 promedio = calcular_promedio(numeros) print("El promedio es:", promedio) print("La suma de los números es:", total) # Aquí hay un error In Platzi bot we put the following prompt: ¿Cuál es el error en el código? ¿Cómo lo puedo solucionar? def calcular_promedio(numeros): total = sum(numeros) promedio = total / len(numeros) return promedio numeros = 10, 20, 30, 40, 50 promedio = calcular_promedio(numeros) print("El promedio es:", promedio) print("La suma de los números es:", total) And in response we have: prompt-3.