Building Innovative Application 5 : Code Execution
The code primarily demonstrates Gemini's?code execution?feature. This capability allows Gemini to not only generate Python code based on your instructions but also to execute that code within the Colab environment and provide the results. The code utilizes the?google-generativeai?package to interact with the Gemini API for code generation and execution within the Colab environment.
It focuses on three primary tasks:
1. Calculating the sum of the first 50 prime numbers:?The code prompts the Gemini model to
generate and execute code for this calculation.
2. Generating a Fibonacci series:?It prompts the model to generate and execute code for creating a Fibonacci sequence up to 50.
3. Determining if a number is an Armstrong number:?The code instructs the model to generate
and execute code to check if a given number (407 in this case) is an Armstrong number.