AI with GitHub Copilot for Developers in 2026 | Arno Pretorius | Skillshare

Playback Speed


1.0x


  • 0.5x
  • 0.75x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 1.75x
  • 2x

AI with GitHub Copilot for Developers in 2026

teacher avatar Arno Pretorius, IT Freelancer

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Lessons in This Class

    • 1.

      Course Introduction

      2:00

    • 2.

      What is GItHub Copilot?

      1:34

    • 3.

      How does GitHub Copilot work?

      0:54

    • 4.

      Create a GitHub account

      2:25

    • 5.

      Visual Studio Code - Installation & setup

      2:08

    • 6.

      Preparing your workspace

      4:49

    • 7.

      Configure Visual Studio Code Inline editing

      1:31

    • 8.

      Installing and setup GitHub Copilot

      4:01

    • 9.

      Utilise AI powered code suggestions to write code

      6:57

    • 10.

      Mastering prompts: Use comments to guide GitHub Copilot's AI

      6:16

    • 11.

      Write a full executable script with suggestions

      6:20

    • 12.

      Exploring the inline and side panel chat feature

      5:37

    • 13.

      Working with various chat features

      7:50

    • 14.

      Best practice for the inline chat feature

      9:25

    • 15.

      Best practice for the side panel chat feature

      3:41

    • 16.

      How to fix and explain source code

      4:48

    • 17.

      How to review and observe comments

      5:21

    • 18.

      Adding context with references to perform actions

      7:03

    • 19.

      Querying entities for specific solutions

      3:29

    • 20.

      Implement slash commands for quick actions

      6:38

    • 21.

      Prompt engineering - Guidelines and best practices

      3:43

    • 22.

      Create your own project

      0:31

    • 23.

      Thank you!

      0:44

  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels

Community Generated

The level is determined by a majority opinion of students who have reviewed this class. The teacher's recommendation is shown until at least 5 student responses are collected.

46

Students

2

Projects

About This Class

What you need:

This course is designed for developers who have no prior experience in AI-powered coding. You don’t need advanced equipment—just a desktop or laptop with an internet connection.

To keep things simple, we’ll use GitHub Copilot alongside Visual Studio Code as our coding environment. You’ll learn how to integrate Copilot into your workflow, write code more efficiently, and leverage AI-powered suggestions. 


What you will learn:

In this course, you’ll explore how to harness AI-powered coding tools to improve your development workflow. You'll learn how GitHub Copilot enhances coding with intelligent suggestions, in-editor chat, and contextual assistance.

As you progress, you'll dive into more advanced capabilities, including fine-tuning chat interactions and crafting effective prompts for tackling complex coding tasks. The course balances theory with hands-on practice, ensuring you gain both a solid understanding and practical skills to integrate GitHub Copilot seamlessly into your workflow.

What you will do:

As you go through the course, you'll start by exploring key concepts with a strong theoretical foundation, then put your knowledge into practice with hands-on lab exercises. These practical activities will help solidify your understanding and prepare you to handle more advanced coding challenges with confidence.

Finally, in the "Projects & Resources" section, you’ll create your very own project. This is where you’ll take the skills you’ve learned and use them to design and build something useful for yourself, putting everything together in a way that’s practical and personalised.


Course benefits:

This course includes:

  • 1.5+ hours of on-demand video
  • Theoretical lessons to learn fundamental concepts
  • Practical lab exercises to apply your knowledge
  • 20+ total lessons

About your instructor:

I’m a software development consultant and a former computer science teacher with a passion for web development, cloud computing, and DevOps. I focus on teaching practical, hands-on skills that help people confidently apply what they learn to real-world projects.

I hold a BSc in Information Technology and a Postgraduate Certificate in Education (PGCE), which gives me a strong foundation in both tech and teaching. I’m also an AWS Certified Solutions Architect and Developer, bringing real industry and cloud experience to everything I do.

Want to learn more?

If you enjoyed this course and want to stay tuned for possibly more courses in the future, please be sure to follow me on Skillshare!

Meet Your Teacher

Teacher Profile Image

Arno Pretorius

IT Freelancer

Teacher

Arno is an IT freelancer and former computer science teacher specialising in web development, cloud computing, and DevOps. He focuses on practical, hands-on teaching that helps learners turn knowledge into real-world projects.

He holds a BSc in Information Technology and a Postgraduate Certificate in Education (PGCE), and is an AWS Certified Solutions Architect and Developer, bringing real-world cloud and industry experience to his teaching.

To stay up to date with his courses you can follow his Skillshare profile to receive the latest updates and announcements.

See full profile

Level: Beginner

Class Ratings

Expectations Met?
    Exceeded!
  • 0%
  • Yes
  • 0%
  • Somewhat
  • 0%
  • Not really
  • 0%

Why Join Skillshare?

Take award-winning Skillshare Original Classes

Each class has short lessons, hands-on projects

Your membership supports Skillshare teachers

Learn From Anywhere

Take classes on the go with the Skillshare app. Stream or download to watch on the plane, the subway, or wherever you learn best.

Transcripts

1. Course Introduction: Welcome to the AI W Gid Hub co pilot course for developers. I'm Anna Pretoris an IT freelancer and formal computer science teacher. And in this course, I'll show you how to integrate AI into your development workflow in a simple, practical, and efficient way. Now, you don't need any previous AI experience. You don't need complex tools. All you need is a computer, visual studio code, and an Internet connection. I'm going to guide you through installing Github copilot, setting it up properly, and understanding exactly how it enhances your coding experience. You'll learn how copilot provides intelligent suggestions, context aware completions, and inline explanations that help you code faster and a lot more cleaner. Now, as you move through the course, we'll go beyond the basics. You'll learn how to craft effective prompts, refine copilots responses, and use it to assist with debugging, documentation, and more complex coding tasks. Now, everything is taught through a combination of clear explanations and hands on practice. Guided lab exercises help you build confidence as you apply what you've learned in real time. Now, by the time that you reach the projects and resources section, you'll be ready to create your own practical project using copilot as your AI coding partner. Now, this course includes more than an hour and a half of structured content over 20 lessons and practical exercises that are designed to help you integrate AI into your workflow smoothly and effectively. Now, I am very passionate about helping developers work smarter and more efficiently. And this course is built to give you real world skills that you can use immediately. So, trust me, you're in good hands. 2. What is GItHub Copilot?: Hi, everyone. Welcome to the next lesson, which is going to be focused on taking a look at what is Github copilot. Now, let's have a look. Github copilot. It is essentially an AI powered coding assistant that has been developed by Gitub. It also integrates seamlessly as an extension in your code editor or ID, and this would primarily be within Visual Studio code. Also helps to assist you in writing code directly within your editor, you don't need to go ahead and utilize external software outside and go ahead and paste in your code outside and then have to keep on going back to Visual Studio cad. It's all integrated nicely for you. It also has the ability to suggest code snippets and entire functions based on your context. Let's say you are busy creating a function that is going to evaluate what the temperature is. What can happen is when you're utilizing Github Copa, it will go in ahead and provide you with some suggestions on how you can complete the code or also how you can go ahead and make it better. Another important thing to keep in mind with Github Copula is that it is very useful in terms of the fact that it supports a wide variety of programming languages. Now these will, of course, go straight across from PySon to JavaScript to HML, and all of the like. 3. How does GitHub Copilot work?: Hi, everyone. And welcome to the next lesson, which is going to be focused on taking a look at how Github copilot works. So let's take a look. Right, so how does Giu copilot work? So, essentially, Gu copilot will read the code that you're writing within your editor, and then it's going to suggest what comes next. It also utilizes AI trained on lots of publicly available code to generate smart suggestions on what code you are attempting to generate within your editor. Now, you can also go ahead and type code or write a comment even describing what you need, and it's going to suggest code for you based on your needs. It also works, as we know, within our code editor and this helps to make the coding process a lot faster and easier for our convenience. 4. Create a GitHub account: Hi, everyone, and welcome to the next practical lab exercise, which is going to be focused on setting up Github. First of all, what you want to do is you want to go ahead and type in Gitub in your search browser and we can Google search. Then you want to click on the first option here that says Git up, build in hip software on a single collaborative program, so you want to click on that. And for reference here, you'll see in your URL, it says github.com, and that's going to be a safe peck that you are on the correct website. Now what we want to do is we want to sign up for a Gitup account. Okay. Then we want to enter in some information such as an email password and username. So let's go ahead and fill that in. So you just want to go ahead and do that. So I'm going to go ahead and do that. Okay. Okay, and then you want to enter in a password, and then a username as well. Okay, so we've got those details in place. And once you're ready to continue, you can just continue being to verify your account. And now you need to complete a visual puzzle here or an audio puzzle, and then you can continue to the next step. So I'm going to go ahead and do that and then we'll meet again after the completion of the necessary puzzle. Now, after completing the puzzle, you're then going to be redirected where you can confirm your email address. So you can just head on over and get your relevant code. And paste that in. Right. And we can see our account was created. So now we can sign in to continue. So you want to enter in your user name or email address followed by your password. So let's go ahead and do just that. All right. So now what we can do is go ahead and sign in. And there we are. So well done, you've successfully created your Gitub account. This is going to become necessary, so make sure that you have it set up and ready to go. And in the next video, we're going to go ahead and set everything up with Visual Studio code. All right. So well done on getting to this point, I'd recommend that you stay logged in, so make sure you don't leave this dashboard. I recommend keeping this open as a tab. All right, so that's it on creating a Gitub account. 5. Visual Studio Code - Installation & setup: Hi, everyone, and welcome to the Next lab exercise, which is going to be focused on downloading and installing Visual Studio code. So let's go ahead and search for this. Here we have download Visual Studio code, Mac Linux and Windows, so we can select that option. Now what you want to do is you want to download Visual Studio codes based on your operating system. So if you are using Windows ten and 11, you can click on this option here to install it on your device, or if you are using a MacOS device, you can go ahead and set it up here accordingly. All right, so I'm on Windows. I'm going to choose Windows. Okay, so it's going to download vis code. And if for some reason it doesn't can go ahead and click on the direct download link if it doesn't automatically download for you. So we can see here that it has been downloaded. I'm going to go ahead and open up the Setup Wizard. Okay, I'll just take a moment. So we want to accept the agreement, then we can see next, next, next. And I want to create a desktop icon, and I'm going to leave the default settings here as they are here. Okay. Now what I'm going to do is say next and install. All right, so it's going to take a moment to set that up. So all we need to do now is be patient as that process is completed. All right, there we go. All right. So let's just give it a moment or so, and then we will continue after the process has been completed. All right, so, welcome back. So as you can see, Visual Studio code has in fact been installed on our system, and I'm going to leave the checkbox here as launch Visual Studio code. I'm going to say finish, and that's going to automatically open it for us, so let's go ahead and say finish. It's going to take a moment and a few more seconds now, and there we are. Well done. You have successfully gone ahead and set up Visual Studio code on your system. Well done on getting to this point. 6. Preparing your workspace: Hi, everyone, and welcome to the next practical lab exercise, which is going to be focused on preparing our workspace. So let's get started. Now, the first thing that we want to do is to create a folder on our desktops. I'm going to do just that. So I'm just going to create a new folder and I'm going to call this My project. Very simple. You can give it any name that you want. It really doesn't matter. Then you can open up visual studio code. And what we can do then is click on the icon in the top left here, go to File. Then we can navigate to Open folder. Then you want to go to your desktop? Then you want to go ahead and open up that particular folder in Visual Studio code called My Project. DR, we now have our project in place. Perfect. Now the next thing I want to mention is the fact that this course is for developers. It is assumed that you are a developer working with a specific language. Whether it is PySon or you're working with JavaScript or even working with the markup languages such as HML, CSS, et cetera. Now, it doesn't really matter here in terms of what you're using because of the concepts that I teach you in this course, like I mentioned. Just for clarity here and just to give you a little bit of some insight, what I'm going to do is just go on ahead and create three different files, one in Python, one in HML, and one in JavaScript. I'm just going to show you the process of how you can just get started here as Visual Studio code. I assume many of you already know how to go on ahead and get started and such, but I'm just doing just for clarity and good measure. What I'm going to do is hover over this area here and you'll see an icon appear called New File. I'm going to click on that. The first one is going to be index j HML, with HML. I'm going to add some code here that says H one, and I'll say hi world. Very simple. Okay, then I'll go ahead and create a new file. This will be PySon and this is going to be main dot pi, for example. And here I'm just going to say print and you might get this extension notice which you can install if you wish for PySons going to close such. And here I'm just going to say hi world. Then one more, I'll call this app dot JS. I'll say console dot log. Hi world. Very simple. I have three files here. Now for clarity, we're going to just use PySon as a demonstration for this course. I just want to just give you some notice on that. Index at HMR, for example, what we can do is we can click here on the following icon, navigate to terminal, and we can say new terminal. You can move that to the side. Okay. And what I can do is I can run this index to HML file by just simply saying starch and referring to the file name, which is index HML, press enter. That's going to open up in the new chab here, Index HML with the flowing code. All right. Just clear that up. Let's say I'm working with the PySon file, I can just simply refer to it as saying PySon and then main dot pie. It's going to execute High world. All right. And then the next one is app dot js. This is assuming that you have no JS on your system. You can just go ahead and say node and then app dot js is the file name, and that's going to output High world. And the same thing also with the PySNFle when I ran PySons going to assume that PySon has been installed on your system. So again, like I mentioned before, for clarity, this is for developers. I was assuming that you have some knowledge in a programming language or a markup language such as HML, for example. So do keep that in mind. And again, we are going to be using pricing just as a demonstration for you to understand how you can apply the Github copilot. So what I'm going to do now is I'm going to go ahead and close everything. I'm going to delete app dot js and index dot HML. If you are coming from a particular background, you can utilize the programming language of your choice. So I'm just going to delete these files. Index. And I'm going to keep maned up since we're using PySon. Perfect. That's just to get ourselves prepared and steady and everything. The next thing we want to do is we just want to configure a few settings in our settings like JCNFar Visual Studio Code, just to make sure we don't have any issues that won't be adopted with Github copilot. 7. Configure Visual Studio Code Inline editing: Right. What we want to do now is click on the flowing icon. Then you want to navigate to view. Then you want to select Command Palette. They is going to give you a list here of preferences and such. What you want to do is you want to look for preferences, open user settings a JS on. You may need to scroll here or you may need to type it out, so you want to click on this option here. Okay. Then you want to scroll down until you see the setting here that says editor in line suggest dot enabled. You want to make sure that this option here has been set to true and that it's not false or else the suggestions that iTu copilot provided us with in VS code is not going to show. So you want to make sure that you set this to true. So you can just remove that and say true. Make sure you save your file then so you can press Control S, or you can go ahead and just simply go to File and then save if it allows you to. That is what you need to make sure that you have set up accordingly, very important that you do this. Then you can, of course, go ahead and close this. What I recommend you do is to restart Vs codes. I'm going to go ahead and close this. Then I'm going to reopen it. Let's see if we've got everything here. Our project is also open. Make sure that that also opens up as well and we are good to go. That's very important that we make that adjustment. 8. Installing and setup GitHub Copilot: Hi, everyone, and welcome to the next practical lab exercise which is going to be focused on installing and setting up Github copiloer. Now before we continue, just make sure that you are still signed into your Gitub account on the dashboard. Very important. Now we can just type in Github copiloer in Google and perform a Google search. Then you want to scroll down till see Github copilot, your AI pair programmer. You want to select this option. It is going to redirect you to the following page here, and we can see that Github copola is now available for free and we can get started for free by utilizing Visual Studio code, which we already have and we can then open up the extension and sign in with our Github account. Now, I just want to give you some clarity on the plans and pricing first so we can see plans and pricing. Now if you scroll down, as we can see, the free option is available here for developers looking to get started with Github copilo. And I do want to mention here that there is a limitation. So it includes up to 2000 completions and up to 50 chat requests per month. So remember, if you decide to overdo it and run away with it too much in this course, then you are going to have to upgrade to the next option, which is for $10 a month. So do keep in mind here we do have a limit. But in this course, if you follow what I do and you are going to just ensure that you don't do too much and you just follow along, then you'll be able to complete the course and everything was in it for free. Do remember there is a limit. Now, for those that want to rather get the prote, there is one available for $10 a month, and we can see that you'll get the first 30 days for free. That will give you unlimited access to Github cop on it and it will be free for verified students, teachers, and maintainers of popular open source projects. You can learn more here if you want to see if you can get some benefits off that. Right. But in any case, let's go ahead and utilize the free tier for this course. Again, just remember the usage limage. What we can do is say open now, and that's going to take us to Visual Studio code. Okay. And what we want to do now is just have a clearer look. So here we can see welcome to copilot. Copilot is your AI pair programmer. We can code faster with completions, build features with copilot edits, and explore our code base with the chat. It's now offered for free as we can see. So you can see sign in to use copilot. Okay. So we can go ahead and click on thatch. That's going to verify your session here with Giub. So this is why I mentioned you should be signed into your Gitub account. So this will be a lot more smoother, and you'll see your username for your Gitub account and you can just say continue. That's going to authorize you. So Visual Studio code is going to want to have access accordingly, and you just want to authorize Visual Studio code. And now you can just say open, and it's going to assign you in Okay. There we go, and you can see here you are currently logged in as your username and we can now see we've got that setup. All right. Perfect. So there we have it. That is how you can go on ahead and get started with AI and in terms of the copilot. So you should see, of course, this icon here as well, and we are all good to go. Now, what you can also do just for further clarity is on the left hand side, you can click on accounts and you can just see that you are signed in accordingly to the user names with opportunity to sign out. So this is just a final check just to make sure that everything is in place. So we can go ahead and close this for now. I wanted to do was just to get you set up and started with installing and setting up Gitub copilot. As long as you can see this icon here and that you're not signed out when you click on your accounts, you are good to go. So well done on installing and setting up Gitub co pilot on your system. 9. Utilise AI powered code suggestions to write code: Hi, everyone, and welcome to the next practical lab exercise, which is going to be focused on utilizing AI powered code suggestions. So let's dive in. Okay, so I'm going to go to Explorer and I'm going to open up my project here and my main dot py file. And here I have a line of code. So I just want to take this out so I can see delete. And there you'll see that we'll have some ghost text that will appear here that says, press Control, and I or if you are on a Macas device, it will show you the equivalent of how you can ask code to do something. And we can start typing to dismiss this ghost test so let's go ahead and write some code. Let's say I say here name equals, and I say, Oh, I go to the next line. It's going to automatically suggest to me in S strings how I can go ahead and print out my name. Very interesting. This is a code suggestion that is built in with Githubs copilot. This is known as a code suggestion. You'll notice here that if you were to hover over this, you'll see a pop up appear that says accept and then tab, then accept word, and then Control and write arrow. Interesting. Let me go ahead and navigate here and click on Accept. Then there we go. I already goes ahead and adds in that code for us. Perfect. Right. Now, what we can do now is go to the next line and add in a new line. And there we go. We've got that all in place. So now let's try and actually run this code. So what I'm going to do is go and click on the following icon. Then I want to go to terminal, new terminal. Okay. And we can just say pyson main Jach Pi. There we go. It outputs Hello Ano. Perfect. So we can see it's output nicely. So that's how you can use a code suggestion. Now, there are many ways we can do it and many different ways in which we can utilize it. So let me remove this now. And it gives us a suggestion here. Same one here again. Now, do keep in mind that the suggestions that it's showing for me might be different from you. Okay? So it's going to be different in each case. All right. Now, what you can also do is hover over this, and you can also say except word. And that's going to output the suggestions word by word you could say. So, for example, if I say except Word, it'll say print. Then it's going to open the parenses. Then it's going to add in the F string, then it's going to add in the particular quotes and then hello and you can see there until the end is just going to do it bit by bit. Now, this can be very useful if you're using a lot of code in terms of functions and you only want a bit of the function to appear, the except word option can be very helpful. Let's remove this again and it's hover over. What you can also do is you can go ahead here and click on the three dots here, which highlight the tool tip here for more actions, and you can go ahead and open up the completions panel. Okay. And here it's going to load all of the suggestions that Github copilot is suggesting for you for your line of code here. So the first suggestion here, we can see it's print in F strings, hello, and then name here in the place holder. That's suggestion one, and you can accept that suggestion. Then here you can see we have suggestion two, so that's going to use string concatenation. So you're going to say print hello, and you're going to have a space by the quotes plus name plus and then explanation point. And then we can see suggestion three. Suggestion four, that's quite the simpler one. There you're just going to say print and you're just going to add in the particular variable name as well. That's what you can do there. Here we can see suggestion five is going to add in some comments next to your output just to give you some cleaner codes. If someone happens to stumble upon your project or program, they can then just see the output there as well. There are many suggestions that you can use here. What I want to do is I want to keep it simple. I want to accept Suggestion four. I'm going to click on that and then it's going to output that code for me. Then what I want to do is go ahead and run my Python file. Okay. And there we go. I outputs Arno. Perfect. So there we have it. That is how you can use suggestions. Now, in this case here, you notice that it only showed one suggestion when we were hovering over the code in terms of the ghost texts. So this is our inline suggestions that we're using here. So the code that we see here is Ghost text, and this is the inline suggestion. And we can see there's only one. Now usually, you can go to the next suggestion and go back depending on the complexity of what you are writing. So let's say for example, we want to rather define a function of sorts, and it's going to be a function that let's say converts fahrenit to Celsius, for example. I can just say Def convert, and I can see before I even put in the underscore, it says, convert to Celsius. Of course, it puts, for example, fahrenit here as we can see as the parameter here, and you can see you can now filter. So this is what I meant before. You can now filter between the various inline suggestions that copilot provides you. Okay? So we can either say convert to Celsius or here it says convert to in. So it's trying to figure out what is our goal? What do we actually want to achieve? All right. So as you go on ahead and you type further, if I were to say convert to and let me hover over it now, and I switch over. It's going to keep on going with those suggestions that you have in place here. And if I say the following, convert to, and then I say Fa and you're going to see here, it now picks up that I want to look for Fahrenheit. But earlier when I just put the F, it's going to assume that I want to convert to float and it's going to provide me with all of the following code logic here for me to utilize. Assuming that I want to convert to float here and I hover over it with my cursor, it's going to show me two ways in which can go on ahead and convert to a float. All right. So this is how you can leverage utilizing AI powered code suggestions for you to write code, right. So just something I wanted to mention on how you can go ahead and get started. All right. So that's the first lesson in which we can utilize Github copilot. 10. Mastering prompts: Use comments to guide GitHub Copilot's AI: Hi, everyone, and welcome to the next practical lab exercise, which is going to be focused on mastering prompts within Gitub co pilots AI. So let's go ahead and get started. Now, what I mean by this is let's go ahead and start to think about a project that we want to make here. Let's say we want to create a program that calculates the total from two numbers, for example. So in PySon, you would, for example, utilize the following hashtag here for defining a comet. So here I want to say, function that as you can see there, it really starts giving me a suggestion to run the main program. Here I'm going to say it's function that calculates. And here, it really gives me some options. So here it says, calculates the average of a list of numbers. So I want to refine it and say function that calculates the total of, let's see what it says now, the total of a list of numbers. Okay? So here I want to say function that calculates the total of two numbers. I now have it figured out as to what I want to do, and then I can go to the next line and I can go ahead and press Enter again. Then it's already going to provide me with a suggested solution. As you can see here already provides me with a function that's going to go ahead and take in two parameters of A and B for the two numbers and the function name is add that correlates to a prompt that I specified earlier that is a function that calculates the total of two numbers. Now if I were to hover over this option here, instead of clicking Except, what you can also do is you can go ahead and click on CHAP as well. You can just go ahead and click on Chab on your computer and that's automatically going to do it for you. Then as I do that, you can see it also suggests, the next thing you want to do is return A plus B. I can go ahead and go and press hab, and then it goes and creates that function for me. Perfect. That's how we can go ahead and ensure that we have a prompt in place so that we can utilize our comments to guide the process of Github co pilots AI. Now, what we can also do is do the same thing that we did before is we want to have more suggestions in play here. Let's go ahead and remove the following. And what I'm going to do is go ahead and press Enter, Hover over, and I want to click on the following dots here for more actions, and then I want to say open completions panel. And let's see it the list of suggestions that Gita copilot provided me with. I can see I have suggestion one. That is to call the function name as sum, put in the parameters X and Y, then we can return the result of what X plus Y is. You can see suggestion two here is a little bit more. You could say user friendly with the function name. I'd add underscored numbers. It's going to take in the parameters of number one and number two and then return num one and num two. Okay. And we can see we've got a few options here. So this is the suggestion that was suggested to us in the line suggestion that we saw here was the ghost text, and that was to say add and then A and B and then return A and B. So you can see here we can go ahead and utilize the same sort of suggestions here that was provided to us. But the important thing to keep in mind here, this is how you can go create your programs by setting up a prompt. In our case, we were referring to a particular comment and based on that comment, we prompted AI to create that particular function for us based on the comment that we said. Let's go ahead and just for clarity, say accept suggestion to add two numbers and there we have it. Now, what I want to do now is I want to remove this and it's test it for something else. I'm going to say function that t's converts a let's say, a integer two, and you can see it automatically knows what I want. You can then press hab to complete that suggestion, press Enter twice. And then here, it really gives me that function automatically, as you can see, de into string. So I want to create a function that converts an integer to a string, so a number to a string, and then I can press hab, and then it's going to give me the particular code that I need. So return, and it's going to utilize casting with STR and then num and there we go. That's how we can go ahead and do just that. Alright. Perfect. So that is how we can go ahead and utilize comments and also how we can master prompts by giving a particular how can I say a program that we want to create? I'll do one more just for extra practice for those that want to practice more. So I'll say a function that can I say, converts cell, and it really picks up what I want to do. A function that converts LCS to Fahrenit compress chat, Enter twice. Then it's going to give me that particular function that I want to use. If I don't like that, what I can do is go ahead and click on the double rs, go to the completions panel. And what I wanted to say is, let's use this one here. You can see it already gives me the code as well here if I just zoom out a tad bit here. Can also see that it gives the full code here as well for it. For example, we can use Suggestion four here that says, Celsius to Fahrenheit, takes in Celsius as a parameter, accept Suggestion four, and there we have it. Perfect. All right guys. That is how we can go ahead and master our prompts. We can go ahead and take that up. All right. 11. Write a full executable script with suggestions: Hi, everyone. Welcome to the next practical lab exercise, which is going to be focused on creating a full script of a program that we want to use. Let's get started. I'll add in my comment. First of all, I want to say, create a program. Okay? That will ask for personal information. Let's see where the suggestions go. So create a program that will ask for personal information and then display it back to the user. So that's going to be via print statement. So I want that to then be written to a files I'm going to say and write it to and we can see it already gives a suggestion to a file, I'll press chat. Rady, you'll figure that out. And now I can just go and say Enter, and we can see here the program should start when the user enters in a blank name, so I'm going to skip such. And here it says, ask the user for the name, address, phone number. We can go ahead and do that. I'll say chat and write this information to a file. Yes, chap. And we've got all the information that's needed. So now if I press Enter twice. Okay. We're now going to see I'll say open the file on Read mode and print the contents of the file to the screen. Okay. So we can go ahead and do that as well. And let's go to the next line. We've got all of that in place. Now we can go ahead and start with the user inputs. I'm going to start and say name and then it really figures out that I will be asking for a name, so I can just press hab, and then you can see here it's looking for the address because we put that earlier on in our comments, we can go aheag and just simply say chat Enter, here it's going to be phone as well since that was figured out earlier on. So we can say phone and tab, and we've got all of those inputs. Now we can go to the next line. And here is what it's going to do. It's going to utilize the Wi statement here to create a file known as personal underscore info dot TXT, and it's going to be created as a file by utilizing the W mode, which is write mode as file. So this is how we can go ahead and open and write to a file. This will be the file name that will be created within our directory, as you can see here. All right. So what we can do is we can go ahead and re instantiate that suggestion, so just press Enter twice. Then it will come up. So remember, if you navigate outwards, it's going to hide that inline suggestion for you. So do keep that in mind. Let's see if there's a better suggestion. So what I'm going to do is I'm going to go ahead and click on more actions, go to open Completions panel, and I'm going to just zoom out a bit. I can see I have a few options here. So file the right name, address, phone number, There's a few options here. What I really like is this one here is suggestion five. I want it to be called InfoGXT. It's going to be written as a file and then we're going to use the write method here to write, of course, the name that we input, the address that we input and the phone and here we're just adding in a new line, pursing that we write in the file. I'm going to say accept suggestion five. And there we go. We've got that script all in place now and ready to go. Now that we have that setup, what we can do is we can go ahead and run this program. So just have a look here in our Explorer and you can see we just have the main pie file. That's where our file is going to be created called Info dootxt it's going to write the name, address and phone that we are inputting within our terminal. If I were to go on ahead and click on the following icon, go to terminal, say new terminal, open that up. What I can do is I can clear this up. There we go. All I need to do is really run my file, so main dot pi. I can just simply move this up here just for readability, just clear this up and we can just say Python, main dot pi. We want to call the particular file. Then it's going to prompt me to enter in the following so we can see here. It's going to ask for the name, address, and phone. First name, I'm going to say Ono oris. Then address here. I'm just going to say 21 Alpine Street. And that's all I'm going to say. And then phone number here. We can just put something generic. I'll say 098-65-4321. Something very generic, and we can press Enter. There we go. That file has been ran, our script has been executed and we can now see it's on a new line. What you can do is you can go ahead and technically hide this panel. Now if we go to Explorer, we can now see that we have a file here, which was created known as Info dottxT which wrote everything that was defined in these variables. On a Pretorius street and the phone numbers, you find open infotxD, we can see we have all of that information that has been written to a file and we did all of this just simply by quering our in line suggestions with Github copie. We didn't write any code, as you can see, we did nothing. We did was we just filled in the blanks when we ran everything, and you can see it's all in a new line as we can see it's been added onto a new line per line of code that was written and information that has been collected. That is how you can see that we can go on a hedge and create a full script with AI using Github copilo. So well done. What I'm going to do now is just clean everything up so we can just press Control A and delete, and then we can click and delete that file as well, right click it and delete. And there we go. So make sure you don't dilute your mind up by far. Right, guys, so that is how we can go ahead and create a full script with suggestions. 12. Exploring the inline and side panel chat feature: Everyone, and welcome to the next practical lab exercise, which is going to be focused on utilizing the inline and the side panel chat features. Let's go ahead and get started. Now, most of you, I'm sure, aware of chat GPT, where you would have a input area where you can go ahead and prompt specific questions or optimize your code or fix coding issues or even generate some code for your programs that you desire to create. Now, what you can do with Github copilot is you can utilize the inline chat feature or the side panel chat feature. Let's start off with the side panel chat feature. So here you'll see an icon for Github copilot and you can go ahead and click on this icon to open the chat, or you can click on the drop down menu and open the chat as well, and you'll see right next to it, there will be the hot key associated with it, which is a quick array of opening the chat. What I'm going to do is I'm going to go ahead and say open chat. That's going to open the chat here on the right hand side or the left hand side, it depends. I'm just going to zoom out a tad bit so you can see it clearly here. As you can see, it's very similar in a way to go on ahead and ask questions like we have with Chat GPT. And we can also see with this here, it is also connected to the file that we're currently working with, which is our main dot pi file, and that's how we can go ahead and utilize it. Now, what you can do is also click on the three dots here. So let me just zoom in a chat bit. You'll see there'll be three dots here which you can click on. So you can choose to decide to open the chat in editor, and that's going to open in a Window form like so you can see it will be like this and we can just close the secondary bar. And now, if we were to go on ahead and write our program, we can also just utilize the chat in the meantime to solve certain issues that we may have or if we want to optimize our code or anything of the like. This is what I prefer, in my opinion, just to have another separate window when asking certain questions. Right now, what we can also do is we can also have it in a separate window as well. So let's say you don't want to have this chat in your editor in VS code, what you can do is go ahead and close that and open the chat again and you'll click on the three dots here and you can say open chat in new window. That's going to open in a new window here. Technically, you can just go ahead and continue as you were, and you can just go ahead and open up this window and just go ahead and type put you want to type here, solve which issue you want, and just carry on like normal. This is where you would open it in a new window. Do keep in mind, once you go ahead and close this, it's then automatically by default, going to open up in the editor itself. That's how you would utilize the side panel in your Vs code editor on the side and how you can also change that side panel to open up as an editor or to open up within a window. All right. These are the options. Now, another thing that you can do is you can utilize the inline chat feature. That's going to go ahead and bring up the same prompt that we just saw now inline code. Let's say we're coding, and I'm just going to say print Hello world, and to that. I'm just adding some lines. What I can do now is I can say here around this line here, I want to go ahead and utilize the inline chat feature. I can right click and I can scroll down until I see copilot, and then here, I can open up the inline chat feature here. The editor Inline chat, which is referred to as also see a hot key right next to it. So depending on the operating system you're using, it's then just going to go ahead and output for you. So let's go ahead and click on that, and there we go. We can now see it's adding in that sort of how can I refer to it as that chat feature that we had earlier on with the side panel? This is now the inline version of it. So here we can ask Github copilot questions and all of them. Now, something I do want to mention is the model. Whether you're using the side panel chat or if you are utilizing the inline chat here as we are doing, it's going to give you the option here to pick a model. So you can see we have GPT four, O, and we have Gemini clade, and of course, you can also enable more models, but this may differ from time to time depending on the time that you're watching this video. So it is going to differ. So do keep that in mind. You can also go ahead and start a voice chat as well. So if you want to perform some sort of function here, you can also utilize the voice chat to give your functions. You can also attach a file for context here. If you want to build on to what you're asking Github copilot to do, you can do that as well. Now, one way in which I saw how you can remove this from your code, a very simple way is you can go to Explorer, just close the file, reopen it, and there it will be gotten. So that's one of the simpler ways in which you can hide that inline chat feature. Right, so there we have it. There is how you can go on ahead and utilize the inline chat feature and how to use the side chat feature as well, which can be branched out to the editor or to windowed mode. So I just wanted to elaborate on how you can use that. And then in the next lesson, we're actually going to use it and test it out. So I just wanted to show you what is available so you get a general idea of how you can use them. 13. Working with various chat features: Hi, everyone, and welcome to the next practical lab exercise, which is going to be focused on actually utilizing the inline chat feature and also the side panel chat feature. So in the previous lesson, we just explore them, and now we're actually going to utilize them. Now the reason I'm doing this quite sparingly and not just jumping in and typing code in there, remember, we are using the free tier and I don't want to go ahead and utilize certain services or aspects of Github copiloer was ensuring that we don't fall into a trap of exceeding usage, right? Okay, so let's go ahead and utilize the side panel first. Okay, now, first of all, I just want to go on a hitche and remove this code, and then I'm going to open the chat and just going to go a hedge and click on the following, and I want to open the chat in the editor and close the side panel. So here I have it open. And what I want to do now is I want to go ahead and create a simple program, which is going to be a student grade checker. Very simple. So I'm going to say, create a simple program that focuses on on building a simple grade checker. Then I can specify the model I want to use. I'm just going to leave on the default for GPT, and I can go ahead and say send and dispatch. So I'm going to create a simple program that focuses on building a simple grade checker. So I can go ahead and design. Okay. So you'll see our Gitub username so it's going to generate. Okay? So create a simple program that focuses on building a simple grade checker. So here we can see Github copilots response. So sure here's a simple PSM program that checks grades and determines if a student has passed or failed based on a threshold. Here we can see it's going to create a function for us to check the grade. It passes in the parameters. Also it sets a default argument here in place for the threshold to be 50, so being 50%. We can also see here in comments here that it has all of the explanations to explain the code to us so that we are aware of what is also going on, which is very helpful. We can also see we have a if statement here to check that. We also have our main program here running with our main function and that's also going to be called to return the result of the students based on their grades accordingly. Right, so that is how we can utilize the side panel. And of course, as you can see, we exploited it within the code editor to generate code. Now, as a best practice, it's best to ra use this side panel here when you are working with lots of code, or if you want to improve code or create code from scratch, it's not really suitable for the inline chat feature. And I'll go a little bit deeper into use cases and just give you a bit of how can I say an overview over what I would say is the best way to go around it. So that's how we can go ahead and set that up accordingly. Let's go ahead and try it again. So here I'm going to say create a simple program that requires user inputs and very simply outputs the Ja. Okay. And then I'm going to say based on school grades. I'm going to run this Okay. So then it's going to just reiterate what I asked it. You can see here it's creating that function. And as you can see here, it went on a hedge and just remodified the program here and added in some exception handling. So error handling, should I say, it's now expecting for students grades to be entered, and then it will, of course, return the result accordingly, and it expects a valid input to be entered in. So what we can actually do is we can actually go ahead and test this out and copy this code and put it into our main dot py file. What we can do is, as you can see here, we have a few icons available. So what we're going to do is to copy this code, head onto main dot pi, and we can just go ahead and press Control V, and there we have this program here in place. Now I'm just going to zoom out a third bit, and we can actually go ahead and run this. I'm going to run this PyCon file. Here we have our terminal. Okay. And here it's going to ask us to enter in the student's grade. I'm going to say 76. Press Enter, and there we go. It says grade 76, and the result is pass. So you can see here that the code here is fully functional and we can utilize it within our PySonFle here easily and it executes our main dot pi file, which we have here accordingly. All right, so that is how we can go on ahead and utilize our side panel chat feature, how we can utilize that. All right, perfect. So well done. Okay. So we've got that in place. So what I'm going to do now is I can close this and we can remove this. So the next thing I want to show you is the inline chat feature. So that is the prompt or the input field where we can go ahead and ask a question or to go ahead and do something within our code itself. In my opinion, it's a bit messy, but there is a use case where I'll show you that will be very helpful in this regard, but let me just show you an example here. Okay, so let's go ahead and get started. So what I can do is I can go ahead and just simply right click. I can go to co pilot, and I can specify editor in line hat. That's going to bring the prompt up here. And I'm going to say, write a very basic program that outputs information. And I'm going to send in dispatch. It's going to write a very basic program that outputs information. So I can see here it's going ahead and created it for me. And if I'm happy with that, I can just go ahead and say accept. Okay? Or what you can do is you can go ahead and re run this statement as well, and there are a few more actions that you can also do is you can view this in chat. Okay, toggle the changes, configure the inline chat as well. So there are a few options, but what I want to do is I want to rerun this, not happy with it. It's going to run again, and it's going to re run that code for me. I see it I'm not good with that. I'll try it again. And what you can also do then is you can say accept if you're happy with it, and then it's going to output that code for you. And let's go ahead and run this and here you can see it's outputting Hello world, which was on the first line. I just moves a bit lower. So hello world, which you can see it was output here. This is a basic PyCon program, and it outputs some information which is also printed out there. Right. So as you can see, very simple way in which you can use the inline chat feature as well. However, it can be a little bit, how can I say uncleaned in my opinion. So you should only use this for certain use cases, and I will go through them in terms of best practices. Right, so there we have it. That is also how you can make your chat requests when you are prompting the models accordingly. All right. That's it on how we can utilize the chat features that are available to us in line and the side panel as well. 14. Best practice for the inline chat feature: Hi, everyone, and welcome to the next practical lab exercise, which is going to be focused on utilizing the inline chat feature in order to add error handling to our code. So let's get started. Now, let's say for argument's sake that we have a file in our project. So here I have my main dot p file. I want to create a new file, and I'm going to call this person info dot gg. And in here, I'm just going to add in some basic information. So I'm going to say honor, Victorious Capewn South Africa. I'm just adding in some basic information and keep note of this file name. It's called person info TXT. Remember that. Now I'm going to prompt Github code pilot to go on ahead and create a simple Python script to read that file. I want to be able to read this person info doTxT file and it must be output in the console log. What I'm going to do is I'll just adding a comment here and I'm going to say, let's call this create a simple script. Okay. Here I'm going to say that will read my file called person info dot TXT. So let me zoom out here. Okay, so I'm saying create a simple script that will read my file called person infoxT. And here it's automatically going to know what I want to do and print the contents to the console. So I'm going to say except, and then I can just press Enter. Okay, and I'm just going to press Enter again. And then here I'm going to say, open the file and remit. Okay, I can go with that. And here it's going to provide me with the code that I need here, so I can first tab. So file equals open person infotxT and then it's going to have R at the end, perfect. Right, we can see that that has been set up for us accordingly. Then we can go on a hedge and press Enter, read the contents of the file, and then to read it, just say Taba content equals file dot Red. Press Enter. And again, and then print the contents of the file tab, and enter. Tab. There we go. So you just need to prompt it a little bit, add in some tabs here just so copilot can help you get to the result that you are looking for. So we're going to open the file in read mode. So hence we have R here, and then we want to read the contents of the file. So we are specifying a variable content that will be assigned to the file object. So the file object here has been assigned to file, and then we're using the Red message to read the contents of this particular file here. And then we're going to print out the contents of the file. Okay. So let's go ahead and run this and actually see the results at hand. So I'm just going to go on ahead and use say new terminal. I want to run this manually myself, and I'm just going to say PySon main dot pi. Okay, so it reads out the information. So Ano Pretorius Cape Town, and South Africa. So it's going to go on ahead and output everything for me that was in the file, so it was output accordingly. Alright, perfect. So let's clear this up. Alright, great. So we've got that set. Now, let's say for argument's sake that I decide to break this code, right? So instead of saying person info dot txt, which is a file that exists in my directory, and let's say I were to replace this with person info, and I'm going to call this chotxt. And I run this so let me look for the command. So PySonmindt pie and I run that. You're going to see that there's an error that's going to be output in the console that says file not found error. And that's because that file, person Info two does not exist. So that is the reason why it's outputting that particular error. So if I zoom out here, you can just see a little bit clearer. So what I want to do now is I want to solve this using copilot. So this is what I can do. I can just go ahead and clear that for now. And here is where the error is lying at the moment. What I need to do is instead of having a situation where my code is breaking, I need to try and add in some error handling so my program doesn't completely break, but I am notified that there is an error. So what I can do is I can highlight my code here or I want to add in error handling too, and necessarily this is the one that we need to do it for because anyone can put in a particular name of a file here, then we can go ahead and right click. And we can scroll down to copilot and you want to say editor inline chat we're going to ask copilot something. I want to go ahead and specifically, let's go ahead and scroll down. I want to add in error handling, I'm going to say. Please add error handling here. What I'm going to do is send that request. It's Zoom out. And we can see here we have some error handling in place here, and we can see we can accept these changes. So this was the change here that's been proposed. So it's going to have a try statement here, it says, file equals open person info txT and then R, and then it's going to have the exceptions here. So if it is a file not found error, which is coincidentally what we had going to print the file so and so it was not found, and then we'll also have exception here for an IO error and then it's going to print an error curd while trying to read the file. We have that in place so it's now not just going to break the code, it's just going to gracefully execute the necessary statement under the exception that occurred. We can see that's been added. If you're happy with the changes there, you can go ahead and say except. Let's go ahead and do that. There we go, we can see that our code now has been adjusted. Now when I run that code again, Let's run that. You can see pie and main dot pi. You're going to go ahead and see that in this case now that we don't get that error that we had before, but now we get attribute error that says non type object has no attribute read. This is the next error that we get. Content equals file dot Read. We went ahead and successfully added in exception handling for this part, but we didn't go ahead and set it up for our next lines of code. What we can do is go ahead and set that up as well. So what I'm going to do here is I'm going to highlight the code that we have here, even the print statement, and I'm going to right click and then I'm going to navigate to copilot and say editor in line chat. Now what I want to do is with copilot here, I want to go ahead and say, add error handling here as well. Enter. It's going to generate the error handling here. So you can see there. We're checking if we have a file object, we want to try and say content equals file read. Then we're going to print the contents of the file here if it's able to do so. If not, and it's going to catch the IO error and then print the following statement here that it's unable to read the file contents. And of course, at the end there, it's going to close the files the final statement. If you're happy with that, you can just go ahead and say accept. We can see how code has indeed been adjusted here. So if I zoom out here, you can see we have gone ahead and adjusted that now. If I were to run the code again, you can see that it just says the file person Info two that takes D was not found and that correlates with what we have right here. So that's going to be output, and you can see here that the rest of the code that we have here is also taken care of. So if for some reason this part here gets passed, then this section here of code, is going to be triggered. Okay, so that is a very valuable way in which we can add in error handling. So as you can see, with the online chat feature, it's a lot more useful if you want to highlight individual code segments, and for example, you want to add error handling to it or you want to perform some sort of functionality to it just so it works smoothly without any sort of issues. Okay. So that is how we can go ahead and best utilize the inline chat feature and how we can get it into place. Alright. So I'm just going to go ahead and get that in place. I just want to clean what we have. And there we go. 15. Best practice for the side panel chat feature: Hi, everyone, and welcome to the next practical lab exercise, which is going to be focused on taking a look at the best practices for utilizing the side panel chat feature. Now, as you can see, it is a lot better to issue a lot more statements and actions by utilizing the panel chat feature as we will also see in this particular lesson, as opposed to the inline chat feature that we just went on ahead and utilized. Okay, so what I'm going to do is to go ahead and say open chat. It's going to open up the side panel for me. Now you can either go ahead and direct your questions and actions right here or you can go ahead and open it in an editor, which I'm going to do and close match, and that's just going to be a lot cleaner. All right. So what I want to do now is I want to create a simple program that let's say that converts from an integer to a string. Okay. Very simple. Okay, so here is a simple program to do just such. There we go, and I can go ahead and copy this and I can paste it. And there we have it. Now, of course, we can run this as well just for good measure. So I'm going to run this file. There we go the integer one, two, three is at the string one, two, three in quotes. We can see that is the first case here. When you are working with the side panel chat feature, this is when you want to go on ahead and create your own programs. Another thing that you want to do with it is also if you want to optimize your programs as well. Let's say you want this to be improved, you can go ahead and copy all of this by saying Control A and then Control C, or you can just highlight it and then right click and then you can just go ahead and copy your code. Then you can head on back to your editor here and you can go ahead and paste this code and you can just go ahead and press and shift and Enter. Here you can just go outside the code and say, can you up to Mis above code for me and make it cleaner. Okay. And this is the question, and that's going to be applied to the above code that you generated, and then you can go ahead and send this. Okay. Here's a cleaner version of the code, and there we go. So we can see now that it's a lot cleaner, a lot more to the point, and a lot more straightforward. Okay. So we can go ahead and copy that, go to main dot point and we can go ahead and remove what we had before. And there we have it. So you can see it's now giving us a more optimized and cleaner line of code that we can use. And again, of course, if you run it, it's still going to output the correct result as you can see here, but you can see it's a lot more cleaner and more to the point, as you can see. All right. So that is how you can essentially go on a head and ensure that you are getting the most out of the necessary chat feature that you're utilizing. All right, so that is essentially it on this particular lesson. So that is the best ways in which you can utilize the side panel chat feature. 16. How to fix and explain source code: Hi, everyone, and welcome to the next practical lab exercise, which is going to be focused on fixing and explaining code. So let's get started. All right, so let's create a simple program with our promptier utilizing comments. I'm going to say a program with an if statement that checks. Let's see what the suggestion is that checks if a number is positive or negative. We can do that. Adding the tab, press Enter, Enter again. We will have the input and tab that will be inputting the number. Then the process if number greats in zero, print the number is positive, else number is negative and output, the process has been finished. All right, there we go. So we can see that we have that program here in place. Now, let's say we want to fix our code. Let's say we have an error somewhere. So what I want to do is I want to change the number here to let's say num. Now, automatically with intellisense and via studio code you're going to see here if you hover over it, it says NUM is not defined. Okay. Now, let's say you wanted to fix this, but you didn't want to go ahead and fix this yourself. What you can do is you can go on a hedge and highlight that particular error or issue that you're facing right, click on it. And you can scroll down and go to copilots and you can just say fix. And then it's going to fix NUM is not defined. And then you can see here it's also going to tell us and explain that the problem is that the variable num is not defined. You should replace Num with number to match the input variable, which of course was, as you can see defined here as number. And as you can see, that is the solutions providing us, and it's also highlighting where that change is going to be and we can just accept. And there we go, we can see that that issue has now been resolved. That is how we can also fix our issue that we have in our code. Now, let's say we want to explain our code. So let me go on the head and highlight everything here. And I want this to be explained to me. I am going to right click. Go to Copil and then I'm going to say explain. That's going to open up the side panel for me here, and here you're going to see it's going to explain the code here and what it does, its use, and the scripting and everything in great detail first so that we can understand what is going on. So as we can see, the provided code snapper is a simple Python script, so it recognizes the language that you're using. Prompts the user to enter a number and then determines whether the entered number is positive or negative. Then it goes into detail with the input function that we're using, the I statements, what is within our I block and our else block as well, and then just giving a final sum up of everything that is occurring as well. Right, so that is how we can go on ahead and utilize our Github copilot to fix our code and also to explain our code as well to us so that we have a better understanding of what is going on. Now, let's do another one of fixing the code. So let me remove this statement in this particular regard. Okay. And let me move this print statement here in the same line. And I'm also going to go on a hedge and remove this statement here as well. And now I want to fix all of this. I'm going to right click, go to copilot and I'm going to say fix And there we have it. So you can see here, we had unexpected indentation, the expected expression, the unexpected initation, intent, not expected. And you can see there, it went on ahead and fixed our code by adding in the missing if statement which we had, which should have been right next to number. And then it fixed everything for us. And by surmise, it figured out what the rest of our program should be about and how the construct should be with our IL statement and the lot. All right, so there we have it. Now, if you're happy with that, you can go ahead and say accept and there you go. Okay, so that is it for this particular lesson on how we can go ahead and fix and explain our code. 17. How to review and observe comments: Hi, everyone, and welcome to the next practical lab exercise, which is going to be focused on how we can go ahead and review our code and also act the suggestions that are made by copilot as to how we can improve the code. First of all, let's generate some code. I'm going to go ahead and open the chat. Here I'm going to go on ahead and create a program that calculates two numbers. We can go ahead and send in dispatch and query Gitu code pilot. Here it's going to give us a simple Python program to calculate the sum, difference, product and quotients of two numbers. What we can do is go ahead and copy the following here. Okay. And we can go ahead and highlight that and paste that in. So here we have that code here in place. Now, let's say we want this code to be improved. So what you can do is you can highlight your code and you can right click on it. Then you can navigate to copilot. And then here, you'll see the option to review and comment, and you want to select on this option here. Going to review your selected code now. And you can see here we have the code review in place here with some comments, and it's just giving us some information saying using float input without validation can cause a value error. If the user inputs non numeric data, consider adding input validation. Then going to show you the suggested changes here with what will go on a hedge and be removed. And then the pluses here will be the recommended changes that it recommends adding in. So we can see here we have a while loop. We have exception handling here for error handling, the Troy accept statements, and we can see that has been replaced in our code as well. Okay, so that is how you can go ahead and see it. Now if you scroll down, you can see you can apply and go to the next suggestion or you can discard and go to next. So you can see you have those opportunities here as to what you want to go ahead and do. All right. So what I'm going to do here is I can also click here on Me actions, and you can say apply and apply and go to the next option, or you can go ahead and say discard discard and copy to the Inline chat or discard and go to the next option. Now, let's say I don't like this, so I'm going to say discard and go to next. Okay. Now if I go to the next one here, it's then going to say, the string undefined division by zero should be consistent with other result types. Consider using none or a specific message object. Now what it's doing is it's looking at the other issues that I have here define that it doesn't like. It's going to show suggested changes and what I can also change and what the difference would be. Now, if I'm happy with what has been in place here, I can go ahead and say apply and go to the next. If I'm happy with that, I can go ahead and look at the next change here that it's requesting here. I can say apply, I want this to be applied. I want to go to the next suggestion here you're going to see here that it's going to give me the final recommendation here, which is the reviews that have been commented and I can apply that. Alright. There we go. So you can see now that everything has been adjusted and changed here according with what I defined. So earlier on, I decided to discard the first set of recommendations, and then later on, I accepted the rest of what was added in for me in terms of the code into what is going to be required and what they think is a good way to go about it. So that's how you can review on your code and see the comments that are available into what you can change. Now you can go ahead and do it again if you want. So let's say earlier I had this line of code here from before that I wanted to change. What I can do is highlight that segment, right click, go back to copilo and I can go and review and comment again. It's going to review that selected code, and here you're going to see it will be one of two suggestions that is going to give you here. So here, again, it was a value error, and I decided to rather discard it and move on to the next suggestion. Okay? So if you appli, you go to the next suggestion. It's going to be applied and go to the next one that's available. But earlier on, I decided to discard it and go to the next suggestion instead. Now, this time, what I want to do is I want to ensure that I don't have this value error. So I'm going to say apply and go to the next suggestion. And then here we have another one that prompts up here in terms of the input function with the WOW loop. I want to add it in now, I've decided and I'm going to apply it. Now you can see I have that Wi loop in and I have everything managed correctly here to make my code more optimized and user friendly. Right, so that is how you can review your code and make the necessary changes. It's very helpful, especially if you need to manage exception handling or anything of the like. Right. So that is it for this particular lesson. 18. Adding context with references to perform actions: Hi, everyone, and welcome to the next practical lab exercise, which will be focused on adding context to ensure that AI is utilized more efficiently within our programs and applications, right? So let's get started. So what you want to do is open up your chat, and then to clean all of the clutter that we have here, you can just go ahead and select new chat. And that's going to clean everything up for you. Now you'll notice here that we have something known as context. You can easily click on the paper clip symbol, or you can type hash tag to attach the context for you. Now we can go ahead and click on the paperclip symbol and here you'll see we'll have various references which we can refer to within copil such as our code base, our current editor. That is our current code file that we are currently within. We can refer to Git changes. If we have a repository and we've got anything linked together, we can refer to that our screenshot window selection. This is a selection of code that we want to modify or edit or anything of the like. We can refer to symbols and also to our terminal last command and selections. You can see there's a lot of things that we can reference. That's exactly what we're going to do. I'm going to show you how you can reference according to the context in terms of your code here. Now, the next thing that we want to do is we just want to generate some sample code. This is going to be the last sample code that we will generate meaning, we won't do anything from scratch again, we'll just build onto our knowledge. So that is what we are going to do next. Right, so let's go ahead and do just that. So I'm just going to maximize the size here of copilot just for now, let's go ahead and create a program. So I'm going to say, create a program for me that takes in, let's say, input and output with student grades. Okay, very simple. We can go ahead and run that There we go. There we have a nice program that we can work with, so we can hover over it, copy it, and you can go ahead and just paste that in. So here we have that code here in place. So we can just go ahead and move this just like that. All right, there we have it. So I'll just zoom out a chat bit here. And move this in. So it's kind of a balance of fine art, you could say here. All right, so we've got that program created here on the left hand side, as we can see. Okay, now, the first thing I want to show you is the selection, the selection context which we can use. So you'll notice if you click on the paper clip symbol here, and you take a look here, we have selection. All right. So you want to add in the reference here for selection because we want to perform selection. You can choose that. We can then see here that selection has been selected ironically. And this is going to be applied to main dot pi file here, but we just need to select a part of code here that we want to optimize. So let's say I want to optimize this wL loop right here. So what I do is I select it. It's going to be tracked here as we can see. So let me zoom in here so you can see. So we've selected this code. It's going to be tracked here and we're going to select it. And now we need to decide what we want to do with that code. So let's say I want to optimize it. What I can do is let's just just seee a bit. I'm going to say optimize this code for me. So it's going to be within the following lines. I can go ahead and send and dispatch this. So here's an optimized version of my code here, as you can see, so it optimizes it for me and checks it and just removes any clutter or anything of the sort just to make it a lot cleaner and a lot more efficient. And you can scroll down here and see the changes that have been made. So it added in the dot stripe method to call the input function, and it's removed unnecessary indentation to improve readability. All right. So this is how we can go ahead and make changes here by utilizing referencing. And what you can just simply go ahead and do is you can say apply to main doppie. So instead of going ahead and copying edge, that can cause an issue. We can apply to main Dot Pi. So it's going to apply that code block, and you can see there it's going to make those changes, and we can see that the green is what has been changed and the red is what has been removed, and you can just go ahead and accept that if you are happy with those changes. Okay, so that is how you can go on ahead and utilize the selection reference. Now, let's say we want to reference everything here within our editor. That's the next thing that we're going to take a look at. All right, so let's continue. So what we'll do now is refer to our context, so attach context, and we're going to look for current editor, so that's where our code is currently within. So we're already in the current file. We've explicitly specified the editor. So now we can just say optimize all of my code. So I can say optimize all of my code, please. You can go ahead and make that request. There we go. It's gone ahead and optimized all of my code for me. There we go. Now what you can go ahead and do is you can just say apply to main dot pie, and you can also see what it did in terms of the changes that it made accordingly here. Now what we can do is go ahead and say apply to main dot pie. Going to apply that code block and changes everything accordingly as it should be. There we have it. Now, if there were significant changes or anything of the like, you'll see the color factor in was the green and the red being removed and such. Now, since we already went ahead and made a big change, we can see there isn't really anything significant at all. Now, that's just the process because we've already gone ahead and selected a big portion of the code which we optimize, and there isn't much to optimize afterwards. So it really depends on your code base and such, but that is how you can apply it to everything. So if you have a program that you make and there are a lot of ways in which it can be improved upon and not just sections, you will see the changes that I showed earlier with the green, and the red earlier on was green being added and the red, of course, being removed. So that is how you would do it, and it would be applied to your case. Okay, so there we have it. So that is how we can add context to Github pi. You can see it's very effective in making the necessary adjustments and such. Right. So that is it for this particular lesson. 19. Querying entities for specific solutions: Hi, everyone, and welcome to the next practical lab exercise, which is going to be focused on adding in additional participants. So let's go ahead and take a look at that. So what you can do is refer to your side panel chat here, and you can just utilize the at symbol or Ampersgn that's going to refer to these entities or participants, you could say, such as Github, terminal, our terminal vis code, our workspace, et cetera. And we can prompt questions based on these particular entities. Let's say, for example, I am referring to VS code, and I want to ask VS code, how can I say fix or adjust the settings of the editor, and I go ahead and say Enter. It's then going to refine my question, search the command and setting index. It might take a moment or so. Okay, and there we go. So we can see here we can adjust our preferences by heading over to the open user settings, and we can go ahead and click here on Show in Command Palette where we can refer a bit more. And as you can see, it's going to give the following options here in which we want to go ahead and take a look at the UI, if we want to look and edit the JSON, or if we just want to adjust the general user settings here, and we can click on the buttons here, and we can go and alter what we want to alter. Now, let's go ahead and set this for our terminal, so let's query our terminal, for example. And let's ask our terminal, how we can use Git to manage our project. So I can say, how can I use Git to manage this project? And we can go ahead and press Enter. We can see here, we get some information, so we can see G in it. Then we add this file main Dot pipe, I think add main Dot pipe, and then we can commit it by saying Git commitm and then we'll make our initial commit. And it gives us some additional description here in terms of the messaging that we're using to commit our message. So that is how we can essentially go on a hedge and we can add additional participants. So we can also go a little bit further in basic things like how we can run code, et cetera. So for example, here, I can go on ahead and say, Hey, terminal, how can I run PySon code? You can press enter. So I'm asking my terminal. And here I can just go ahead and say python dot backslash main doot PIE. That is a way in which we can go ahead and execute the code that we are working with in terms of the script. Okay, so we can see we can go ahead and ask various questions here by referring to these entities or participants as I go on ahead and name them. Right, so we've got that set, and what I want to do now is actually, it's set a new chat here and just clear this up. So there we have it. There is how we can go on a hedge and refer to our particular entities, right. So that is it for this lesson. 20. Implement slash commands for quick actions: Hi, everyone, and welcome to the next practical lab exercise, which is going to be focused on utilizing slash commands with Github copilot. You can see here with the side chat feature here that we have Ford slash Fix. We have forward slash test and we have Ford slash Explain as we can see here. Now we're going to go ahead and utilize this with our inline chat feature, so we can temporarily close this for now. As you can see, we have some code here. Let's say we want to go ahead and test it, but we don't want to just say right click and chest. We want to utilize our inline chat feature. Right here, I want to test all of this code here. Essentially everything here within this wile loop, right above that, I'm going to go ahead and say right click and go to copilo and I'm just going to bring in the editor inline chat. I have that here available for me. Now what I'm going to do is I'm going to highlight everything here that I want to check. Then in the promptie where I can ask copilot, it's going to still highlight. I can go ahead and add in a forward slash. Now, we have a few options here. We can go ahead and add documentation code for the following symbol here that we have set. We can edit the selected code in our active editor, which we are currently within main dot pi. We can explain our code, which is in our active editor. We can also fix our code. If we have any issues or anything of the like, we can go ahead and do just that. We can also generate a new code, and we can also perform unit tests for the selected code. Let's go ahead and keep it simple. Let's go ahead and start off by just explaining. So very simple. I'm going to select Explain and just going to explain how this code works. So let's go ahead and press Enter. And we can go ahead and see that it's going to be sending that request, it says, as we can see, let's just wait for this generated. So it generates and explains how this code works in great detail and how everything works together with the variables, the functions, the methods, all of the exceptions that are uti. I think we can see it's been highlighted such as try, the break statement, and we can see how all of that is being set up for us. Okay. So that is how we can go ahead and utilize the slash command. Now we can also do is keep this code here highlighted. But let's go ahead and for the meantime just close this. And I'm going to make some mistakes. I'll say, and I'm going to highlight this code. Then I'm going to go ahead and right click and we can say copilot. Let's open our inline hat, and I'm going to say forward slash fix. Enter that. And I want to propose the fix for the selected code. So I can say Enter. And then it's going to take a look at what's wrong, and we can see here that the issue was with the wile loop here, so it was just Y and it needs to be wild and we also needed to ensure proper indentation. So you can see it went ahead and changed that, so you can see here in the green here, this was the code that was fixed. And if we click the toggle on more actions, we can also see some more information, so we can say toggle changes, and we can see the red which was changed here, we can see that has been adjusted for us. Right, perfect. Great. So we can see that's correct. And if we want to accept it, we can just say accept. Perfect. Great. Now, what we can also do is go ahead and highlight the code again, right click and Goog and choose the inline chat feature again. And let's see what else we have. Okay, we have FIX explain. We can also go ahead and edit the code, so we can edit our code as well. So we can put forward slash Edit. Okay, so we got no results here, so we're going to have to refine our input. So you need to be specific when you're doing the edits here. So when you put in forward slash Edit, you're going to want to define what do you want to edit. So here I'm going to say, how can I say, improve the readability of the code. And you can say edit code. There's going to improve the readability. So we can see what has been changed here, and we can see that it went ahead and did just that. So when you are editing it, you can't just put farlash Edit, as I showed you. You need to be specific on what you want to edit here. So we can see the changes that were made and we can go and say toggle changes so we can see what was changed here. So it went ahead and just remove that try accept statement here, and it just put everything in line outside of the if statement here just to make this a little bit more readable, which can be helpful if you're just looking at it for the first time this code that you're working with. If you're happy with that, you can just say except. If you want it to run again, you can just say re run, and of course, you can go ahead and decide how you want to go on proceed. I'm going to say except. There we go. So we can see that that is now more readable in terms of the code. Now, let's say for argument's sake, we have someone that wants to understand the code. They haven't coded the program themselves, but they just want a quick overview. It can be very helpful to add in some documentation quickly. If you need to explain a segment of code to someone, you can just highlight the code you want to go ahead and comment here and right click go to copilot. Enable the inline chat feature as before, and then you can just say forward slash Doc, this is going to add documentation for the selected code. And then afterwards, you can just press Enter, and of course, you'll see it will now say Add documentation comment for this symbol and Enter again. Then it's going to generate some comments here, and you can see here the comments that are going to be generated to explain the code that we're doing here. We can see it's been nicely set up. Is going to specify all of the details in terms of the terminology and also in a simple pography as you can see, it's going to say what the functionality is, what to expect of the inputs, what is going to be the outputs, and some extra notes here just to denote what is occurring in this particular segment of the code that we are working with. If you're happy with that documentation in terms of what's been added in, you can just say except and that we'll add it for you and explain what is occurring here in this program. That is how you can also make use of slashes as well. These are known as the slash commands that we can utilize in our programs. 21. Prompt engineering - Guidelines and best practices: Hi, everyone, and welcome to the next lesson, which will be focused on prompt engineering. So let's take a look. Now, in order to be successful with AI generation and utilizing Github copilot, you need to make sure that you generate good prompts, and good prompts are going to yield better results. So let's take a look at what you need to focus on in order to have good prompts that generate efficient results. So first of all, you want to use role based instructions. You also want to be very clear and specific. You want to iterate and refine. And lastly, you want to give context and constraint. So let's dive deeper into each of these factors, and let's take a look at example of a poor prompt compared to a good prompt in four of these fields. Right, so first of all, let's look at using role based instructions. So a bad prompt would be to simply say explain recursion. A good prompt, however, would be to add in some of a role based sort of scenario to it. So, for example, here, I'm saying, as a programming instructor, explain recursion with a simple example in pyson. So you can see I'm attaching a role based on an instruction. Then we have be clear and specific. So if you just go ahead and write out write a pyson function for me, this is not going to yield a very good result. However, if you were to be a little bit more specific and say, write a PySon function that takes a list of numbers and returns the sum, this is going to yield a much better result and something that you will most likely looking forward to. Next, we want to iterate and refine. So on your first attempt, you may go on ahead and write a function to check if a string is a palindrome. You don't get the result that you want, so don't be disartan. You can go ahead and just refine what you're saying, just a touch of a bit, just to improve on your responses that you're receiving. You can go ahead and just say, write a Pison function that checks if a string is a palindrome, ignoring spaces and sensitivity. You might not get the exact result the first time, but you're very close. You just need to refine exactly what you see in the response is not what you want and just touch a little bit on it. Refine a tad wear. And finally, you want to give context and constraints. For example, here, I'm not giving any context or setting any constraints by saying write a sorting function. That's very basic. Instead, here, what I'm saying is, I'm going to go ahead and instead write a PyCon function to sort a list of numbers in ascending order using the bubble sort algorithms here. You can see I'm adding in some context into what I'm doing and I'm adding in the specific constraints for this result that I am expecting. Right. Okay, guys, that is for this lesson on prompt engineering. Remember that you need to follow the four phases. Again, let's go ahead and look at them backwards. Give context and constraints. Iterate and refine. Be clear and specific and use role based instruction. Remember to follow those four factors to ensure that you are utilizing AI to its best use. All right guys, that's it for this lesson. 22. Create your own project: Hi, everyone, and welcome to the next lesson, which is going to be focused on creating our own project. So let's take a look. So creating your own project. So now, with all of your newly acquired skills, it is time for you to put all of that to good use and create your very own project. So for additional information, what I recommend you do is to head on over to the project and resources section of this course, right. So good luck with your project, and I hope it goes well, and I cannot wait to see it. 23. Thank you!: Hi, everyone. And welcome to the final lesson of this course where I just want to thank you for deciding to complete this course. It has been a pleasure teaching you and I hope that you got some valuable knowledge out of it. So thank you very much. If you have some time, I would appreciate it greatly if you would consider leaving a review. Since improving my courses and doing as best as I can is always a positive you have some time, I would greatly appreciate that. If not, that's perfectly fine as long as you had a great learning experience, and that's it for me and good luck on your development journey, and I wish you all the best. Goodbye, and thank you again.