Use ChatGPT to learn to code - the right way

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
gpt4 is here and I think we're at the start of a revolution in AI supported learning which is very good if you want to learn a code let me show you why in this video I want to show you how you can use gpt4 to learn to code and I think you're going to be impressed by the results you'll see how it can tailor a coding course just for you you'll learn how to prompt it to get what you want and you'll see how it can explain code that you don't understand you'll also see how it came up with this tic-tac-toe game in seconds we can't blame people who are using chat gbt it's not their buff so one of the best ways of learning to code is to have a coding mentor on and I want to show you how to use gpt4 and GPT 3.5 as your own personal coding Mentor let's do that now okay so let's get started I'm using chat GPT here with the gpt4 model but if you want to follow along with 3.5 that'll be fine too so the best thing to do when you're prompting chat GPT when you're asking it to do something for you is to be as specific as you can so instead of saying something like teach me python it's better to give more details so here I've put I'm a beginner at learning python actors by Mentor I want you to tell me how to Learn Python which topics I should focus on and what methods will achieve the fastest results I'm also novice at using chat GPT please guide me on that too I want you to critique my prompts and tell me how to improve them so let's have a look at the answer and this is pretty good okay so start with the basics dive into data structures learn about file input and output understand error handling with try accept blocks and then it also gives some advice on how to use chat GPT effectively so I would say adds a first answer this is pretty good now depending on your use case you might want to do something else you might want to Learn Python for web development or you might want to learn it for data science in which case you would need to put that in the prompt and it will give you a slightly different answer so you must ask it for exactly what you want so how about a more specific question now let's ask it about decorators because they can be quite confusing so here I've said I don't understand decorators please explain them to me as you would to a high school student use coding examples and what we get is a fairly decent explanation of decorators pitched at the level that we want explaining how they work and actually it uses a really nice little analogy imagine you're on a high school play and you Your Role requires you to wear a costume the costume is like a decorator it doesn't change who you are but it adds something extra to your appearance and we get some code which shows the input and output one of the first times when you realize how difficult coding can be is when you're asked to do tic-tac-toe because up until that point you've usually just learned about variables and conditionals and loops and functions and then all of a sudden you're asked to make Tic-tac-toe and you think how on Earth is what I've been learning anything to do with making a game like Tic-tac-toe and that's when a mentor can come in really handy and so what I've done is I've asked chat GPT to act as a mentor in that situation so I asked it here and I specifically asked it not to give me the answer but I asked it to give me some advice on how to do it and the advice is really good so set up the game board display the board Define the game Loop get player input check for a win or Draw Play Again optional and then it gives some other advice and that's just how you should break a problem down so one of the more interesting things that you can do with gpt4 is you can get it to explain code to you and that's what I've done here so I need to put my glasses on because I can't see the screen okay so what I've done here is I have copied and pasted a solution to one of the leeco problems and it's just the balance parenthesis problem that checks to see whether parentheses are in the right or opening and closing order but I haven't told it that and I've just copied and pasted the solution here as you can see and I've asked it to explain it to me so here's the code and here it says this code defines a python class named solution which has a single method is valid the purpose of this method is to determine if the given input string s contains a valid sequence of parentheses so it's got it right and then it gives a step-by-step explanation of the code which I think is pretty useful so again this is how gpt4 can be a mentor for you and not only does it explain it to you but then it has a few examples it's tested it so it tests here whether it's actually working it does some test cases now I asked gpt4 to create a tic-tac-toe game for me here it is write a graphical tic-tac-toe game in Python since we'd asked it to give advice on how to do it I wanted to see what its tic-tac-toe was like and I'll show you that in a second before I do there are just a few last things I wanted to tell you I've had quite a lot of fun asking it to create flashcards for me on any topic that you can think of but remember specific prompts are really good I was looking for some data sets and I asked it to recommend where to go to look for data sets for doing data projects that was a really good answer it can write documentation for you as well so you can put code in and it'll write documentation for that code that's pretty good and if you want to it to create a learning schedule for you it can do that too right let's have a look at that tic-tac-toe game so what I did was I said write a graphical tic-tac-toe game in Python and it gave me the code which I just copied and pasted into a code editor let me run that for you now it's created a two-player game the next iteration could be one where the computer plays against you but you know we've got something that works and when you put in a winning move that ends the game let's see if we can do that now there wherever you are in your coding Journey the best place to get a deep understanding of the key Concepts is brilliant.org the sponsor of this video I've been using brilliant for years to learn stem subjects like Ai and computer science and it beats everything else to learn something properly you have to do it it's the application of the knowledge where the learning takes place and that's where brilliant excels their interactive platform builds your analytical thinking skills by presenting you with problems and puzzles specifically designed to engage your curiosity and enhance your understanding they have thousands of lessons with new lessons added monthly here's a question from the binary search section of the algorithms fundamentals course they're using binary search to look for the number 88 in this array it's this one here starting with a guessing interval of 1 to 50 and you check A8 and find the value 19 that's this one here what should the new guessing interval be one to seven no one to eight no eight fifteen no it can't be that 9 to 15. it looks like it could be that one because this is in here and that's over yep nine to Fifteen it's got to be that right should we give it a go we got it right the platform's designed so that you can Master Topics in as little as 15 minutes a day to get a free 30-day trial go to brilliant.org forward slash python programmer or just click on the link in the description and the first 200 of you will get 20 off brilliant annual premium subscription
Info
Channel: Python Programmer
Views: 51,075
Rating: undefined out of 5
Keywords: gpt4, chatgpt, coding mentor, giles mcmullen
Id: X_TbI4fueBI
Channel Id: undefined
Length: 7min 19sec (439 seconds)
Published: Wed Mar 22 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.