You can also use ChatGPT to write code with zero foundation, it’s not too cool

Recently, most of the dynamics and topics in Moments are around ChatGPT. As a powerful and versatile chat robot, we can do too many things with it. For example, use it to write copywriting, write scripts, plan travel routes, and even write novels and so on. In this article, we will explore how to use ChatGPT to help us write code without any foundation, so that programming will not be difficult. Whether you are a beginner or an experienced user, I believe you will be impressed with the capabilities of this AI conversational bot. Without further ado, let's get started.

Use ChatGPT as a python interpreter

Before we start, we want to understand how the python program works, so we can just ask ChatGPT, here is its answer:
image

It can be seen that steps 1 and 2 need to be completed by ourselves. The execution of subsequent programs depends on a python interpreter. Generally, we need to install a python interpreter locally in advance, but now we will directly let ChatGPT play this role.

Enter the following text in the chat input box

Please you act as a python3 terminal, I will enter the code and you will reply with what should be displayed. I want you to only reply to the terminal output of your code and nothing else. Don't write explanations. Don't write code unless I instruct you otherwise. When I need to tell you something in Chinese, I put the text in curly braces {like this}. My first code is: print("hello")

ChatGPT will reply after receiving: hello.

Then you can start programming with ChatGPT.
image

Please note that there is a typo in the command I sent to ChatGPT, the correct one is {please write a piece of code to get yesterday’s time}, but I typed it into an event, ChatGPT not only correctly understood my real intention, but also gave the answer , this really surprised me. We don't know how many of these low-level mistakes we have in our work, but there is nothing to hide from ChatGPT!

Debug code

No one is perfect, and it is common for code to have bugs. Using ChatGPT can quickly help you debug code and solve bugs. Not only that, but it also explains what caused the error and how to fix it.

image

help you write code

This is the stage where ChatGPT performs. As long as your requirement description is accurate enough, ChatGPT can understand and write the corresponding code.

For example, we can let it write a 2048 game, and if you are tired of writing code, you can fish for fish haha.
image

The following code is very long. I only cut a part of it. You can see that ChatGPT pays great attention to the comments of the code when answering, and it is not difficult to read at all. In addition, if the code given is too complicated, ChatGPT will interrupt the answer when the computing power is tight, and only need to issue the command {please continue}.

Quickly check documents

When I used to write code, I had to search a lot on the Internet for problems I didn’t understand. Finally, I had to read it from beginning to end when I found it. Only when I understood it could I start writing code. Now with ChatGPT, we can greatly shorten the time for us to look up information.

for example

image

You can see that the answer given by ChatGPT is very concise, with examples. Really exceeded my expectations.
The above is just the tip of the iceberg of ChatGPT’s capabilities. It can also be used to write papers, homework, songs, and novels. In the past, people thought that AI could only do some repetitive mechanical labor. Now AI is powerful enough to perform creative labor, and even some Sometimes there is some human touch in the answer.

If you are interested in ChatGPT, AI and quantification, please pay attention and reply to "Jiban". I have compiled relevant information and tools here, and I can share them with you. I hope to help everyone in the face of this epic scientific and technological revolution. Seize the opportunity and use AI to help us make money.

Guess you like

Origin blog.csdn.net/u011876982/article/details/129905951