Using GPT Plugins to Assist Programming Education

Click the blue text to follow us

Recently, the popularity of GPT has not diminished, especially after the opening of the GPT plugin market, which is generally considered to be as significant as Apple’s “App Store” back in the day. On the surface, this seems unrelated to our education and teaching, as due to OpenAI’s restrictions, most people in China have been unable to use ChatGPT’s features normally. However, because of the existence of this plugin market, we can indirectly use some specialized functions of GPT through third-party plugins that can be accessed normally.

Today, we will introduce a powerful standalone GPT plugin called “Cursor”, mainly looking at its effectiveness from the perspective of its specialty – intelligent code assistant.

In the past, when we needed a standard bubble sort algorithm example for teaching or self-learning the Python programming language, we could simply state our requirements in natural language, and this intelligent assistant could write the code for us. The default response is in English, but we can also request a response in Chinese, as shown in the image below.

Using GPT Plugins to Assist Programming Education
Using GPT Plugins to Assist Programming Education

With this code, we just need to copy it and paste it into the code development environment to run it and see the results. The image below shows the results after running the code three times.

Using GPT Plugins to Assist Programming Education

From a teaching perspective, we can not only let this intelligent assistant help us write code but also explain parts of the code that we do not understand. For example, if we do not understand the phrase “for _ in range(8)” in the above code, we can ask the intelligent assistant for an explanation.

Using GPT Plugins to Assist Programming Education

From the answer, it is clear that it not only explained the content we did not understand but also maintained the context of the previous conversation. This is very helpful for our teaching of computer programming languages with the assistance of artificial intelligence. We can continue to ask questions, such as requesting the intelligent assistant to implement a different sorting method, like selection sort.

Using GPT Plugins to Assist Programming Education

From the response, we can see that it not only used a new method for re-sorting but also anticipated that our intention to ask for a different method was to compare the two algorithms, thoughtfully pointing out the key differences.

We can further request it to output the result after each “element swap”, so we can see the entire sorting process. The image below is the intelligent assistant’s response.

Using GPT Plugins to Assist Programming Education

We can run the code again in the development environment and successfully see the corresponding results.

Using GPT Plugins to Assist Programming Education

We can also ask it more questions about these two common sorting algorithms, such as which algorithm is better. The image below shows our two rounds of dialogue with the intelligent assistant, which was able to answer the questions quite well, even though the last sentence was not completed, it was still quite good. Moreover, we will find that if we are interested in learning more, we can actively expand our learning by continuing to inquire about the quicksort algorithm.

Using GPT Plugins to Assist Programming Education

In such an interactive process, the intelligent assistant gives corresponding feedback based on the learner’s needs each time, helping learners solve the current problems they encounter, and can continuously expand the possibilities for the next steps in learning. This is what we advocate as using artificial intelligence for “adaptive learning”, where each student’s learning path and nodes come from active choices, rather than passive pushes.

The capabilities of this intelligent code assistant are not limited to intelligently processing basic code; we can also ask it to write some advanced algorithms and provide explanations. For example, writing a program to find prime numbers within 100,000.

Using GPT Plugins to Assist Programming Education

The results of this code’s execution are shown in the image below.

Using GPT Plugins to Assist Programming Education

In fact, the intelligent code assistant can not only solve pure algorithm problems but also help you solve practical problems at work with code, even if you do not understand code at all.

For example, we now have a text information database of 1,000 people (not real data) and we want to query which province, city, and district each person belongs to based on the first six digits of their ID number. We have found an xlsx file online that corresponds the first six digits of the ID number to the location, and now we just need to inform the intelligent assistant of the information we have and the problem we need to solve, and it can write the code for us.

Because this task is somewhat complex, the code generated the first time encountered an error when running, but we just need to copy and paste the error message to the intelligent assistant and ask it to make targeted “optimizations”, and we can successfully complete it. The image below shows the code after one “optimization” and the data screenshot after running, where the three columns on the far right are new content. Some results were not found because some virtual ID numbers did not correspond to specific areas. Moreover, the original 1,000 data entries were also generated by the intelligent assistant’s code.

Using GPT Plugins to Assist Programming Education
Using GPT Plugins to Assist Programming Education

Currently, this intelligent code assistant can be used after downloading and installing from the official website, supporting Windows, Linux, and Mac operating systems, as well as various commonly used programming languages such as Python, JAVA, PHP, and JS. It can be used for free now, but based on testing, there is a limit to the amount of dialogue calls per day, and exceeding the limit requires upgrading to the PRO version.

Using GPT Plugins to Assist Programming Education

You can also find and enable the “Cursor” plugin directly in the plugin management feature of development environments like VS Code to assist with programming. Regardless of the installation method, you just need to remember two shortcut keys when using it: Ctrl+K and Ctrl+L, the former allows the intelligent assistant to write and optimize code, and the latter is a way to learn from GPT through dialogue.

Using GPT Plugins to Assist Programming Education

Alright, this concludes the introduction to the main application features of this intelligent code assistant. If you have done something new with it, please leave a message or submit an article to let us know!

Contributed by: Ningbo Education Service and Educational Technology Center

Edited by: Jiang Xiang

Initial Review: Ye Saijun

Second Review: Wang Gang

Submission Email: [email protected]

Using GPT Plugins to Assist Programming Education

Ningbo Smart Education

nbseduwx

Long press to recognize the QR code on the left to share a smart life with us.

Leave a Comment