VP 10: Python 3 Installed Locally
https://code.visualstudio.com/DownloadDownload and install the correct version for your operating system.
Visual Studio Code launches, as shown below.
https://codeium.com/Click the green "Get Extension" button.
On the next page, you are asked to select a framework. Click "Visual Studio Code".
Create an account. I recommend signing up with Google.
A page opens titled "Codeium in Visual Studio Code".
Click the green "Quick Install" button.
In your browser, click "Start Visual Studio Code"
In Visual Studio Code, on the Codeium extension page, click the Install button, as shown below.
A series of boxes ask you to log in to various services, bouncing you back and forth between Visual Studio Code and your browser. Approve all of them.You end up at a browser page titled "Provide Authentication Token".
Follow the instructions on that page to insert your authorization token into Visusl Studio Code.
An alternative method is to click the head icon at the lower left of Visual Studio Code and click "Sign in with Codeium...".
If no folder is open, open a folder to work in.
Enter a file name of prime.py
When a box pops up in the lower right offering to install a Python extension, as shown below, click Install and perform the installation.
In the "prime.py" pane on the right side, type this line, and press Enter:
def is_prime(n):
Code appears to execute a very primitive
test of primality,
as shown below.
Press Tab to accept the code.
Press Enter twice to move to an empty line at the bottom.
Type this line, and press Enter:
# input integer from user
Code appears.
Press Tab to accept the code.
Press Enter twice to move to an empty line at the bottom.
Type this line, and press Enter:
# test to see if num is prime
Code appears.
Press Tab to accept the code,
as shown below.
At the top center, click "Python debugger".
Click "Python debugger: Debug the currently active Python file".
A Python Debug Console pane opens at the lower right. At the "Enter an integer:" prompt, type
100
Press Enter.
The output says "100 is not prime", as shown below.
ML 161.1: List all Prime Factors (15 pts)
From the File menu, create a new file named list_factors.py.Write a program that will list all the factors of a number, as shown below. This should be very easy to do.
Run the program and enter this integer:
The flag is covered by a green rectangle in the image below.
12345
Posted 8-5-24