From the course: Getting Hands-On with GPT-4: Tips and Tricks
Unlock this course with a free trial
Join today to access over 23,200 courses taught by industry experts.
Generating code - GPT Tutorial
From the course: Getting Hands-On with GPT-4: Tips and Tricks
Generating code
- [Instructor] You're helping out at a fruit fair and are writing down what everybody wants to eat. You realize you have a big list, but you need a final count to give to the fruit preparation staff. Let's have GPT-4 help us write some code to do this task. So I'm going to ask GPT-4 to write some JavaScript code for me. Let's head over to our Exercise Files and grab our first prompt. I'm in 03_02, and I'm going to copy in this first part. All right, let's paste it in. It's very straightforward, "Write some JavaScript that takes in a list of fruits and counts how many of each there are." Hit Enter. We got some code, and we even got a test list here to try out. Let's go ahead and copy this, and we're going to run it in our browser. We're going to hit Inspect, going to go to Console, and we're going to paste and run. And there we go. The output matches what we saw in our test. That's great, but at this fair, we…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.