Python for Beginners Workshop: Build Your First Useful Program
Key Takeaways
This video teaches Python fundamentals through a hands-on workshop where attendees build their first useful program, focusing on project-based learning and coding basics using tools like PyCharm and Python editor.
Full Transcript
Hello, hello, hello, hello. Good morning, good afternoon, good evening, depending which part of your world you're in. It is evening here where I am. I'm based in the UK, so it's 9:00 p.m. here, but it will be whatever time it is where you are. Um, I'm filling in this first half a minute while people's join in. Join and it's it's only on the hour now, but we'll make a start. Um, we have quite a few of you already and I'm sure more will join as we start. We have a a broad audience, not just from where you're based. I'm assuming it's from all over the world, but also in terms of technology. This is the first time we're trying this. We're running this on Zoom and there are some of you um if you're on the Zoom meeting then you know you're there and you know how Zoom works right? I don't need to tell you that but um quite a few are approaching 200 watching on some sort of stream on social media whichever social media you're on. If those of you watching on social media streams want to join on Zoom so you can ask questions live that's where you can uh get access to Zoom. Doesn't really matter. It's the same session. It's just on Zoom. You can use your voice if you want to ask questions. Um, realpython.comlive, you'll find the link and you can swap to Zoom or you can keep watching it where you are. Um, good. Uh, let's make a start. Let me start by let me actually move on to the proper starting point. Right, there we go with a big picture. Um, workshop is being streamed live and it's being recorded so that you know you're aware. Um, first of all, who am I? Not that you care. You're not here for me. You're here for Python. But, um, my name is Steven Grapat. I'm one of the core team members here at Real Python. And I'll be with you for the next 60 to 90 minutes. Um, will probably be something in between those two. Um, guiding you through this, uh, Python project. Um, first of all, what should you expect in the next hour and a bit? This is a workshop aimed for beginners. If your level is proficient, if you feel like you're a very intermediate to advanced Python programmer, this workshop is not for you. You're more than welcome to stay. You You might still enjoy it. But this is very much a programming 101, a Python 101. So, if you've never done any programming before, you're in the right place. If you've never done any Python before, you're in the right place. Even if you've done a bit of Python, um, but you still consider yourself a beginner. You'll find some topics you've come across before because we're going to start from the basics. But in some ways, it doesn't matter because one thing that um I believe in when I'm communicating about Python and something we do a lot in real Python is to focus not just on how you do things, but why things are the way they are. So even if you've done you've already done a bit of Python and some things we'll talk about will be familiar, I'm sure you'll find a deeper knowledge, but this is a beginners's workshop. Um, so if you've never done Python programming before, don't worry. I'll guide you step by step. Um, it's going to be a project, so I won't have any PowerPoint slides. The ones you're seeing now are the only ones I have pretty much. Um, very soon in a minute or so, I'll jump to my coding editor. I'll be coding. We'll be coding together. Um, I encourage you to open up your Python editor. Hopefully, you've got it set up. Doesn't matter what, and code along with me. I'll go at a pace, which means that you can code along with me. There will be one or two bits where I might even pause and let you code a bit. So, I'll give you a bit of a task. So, the best way to get the most out of this, you're more than welcome to sit back with your popcorn and watch, but if you have your Python in front of you, if you code along with me, that's much better. Um, as we cover, we're going to work on a project and I'll introduce it in a few seconds. The aim of this workshop is not to pick one or two topics and explore them in detail. Instead in this project we're going to explore or rather we're going to come across a number of Python fundamentals. Now this is a 60 to 90 minute workshop. It's a Python 101. There's a limit on how much we can achieve in 1 hour 1 hour and a half. So all the topics I I'll describe and discuss and I'll make sure you understand what's happening as we go through. But each and every one of the topics we'll discuss today. If you want you can expand your knowledge further later in the session and again at the end I'll share with you a list of resources so that if you want to take the next steps from the topics we've discussed today you know where to go you know what articles to read video courses to watch etc etc I'll tell you more about this later on this session is recorded I'll also tell you where you can get access to the recording so if you need to pop in and out of the session or if you can't stay till the end don't worry I'll tell you where you can get the recording We've also got a bit of a a present for you joining. So I'll tell you more about that um later on. I want to get started now. Um broadly speaking, I'll work in in most of the session. I'll be working on a project about 45 minutes to 1 hour and then there'll be a Q&A session at the end. I'll have as much time as needed for the Q&A. But this is important. This is not one of those sessions where you sit there and wait until the end and there is a Q&A session at the end. There is a Q&A at the end, but you're more than welcome to stop me at any point and ask questions at any point. How you ask questions depends on where you are. If you are on Zoom, you know how Zoom works. Uh you won't be able to unmute yourself directly, but if you raise your hand the normal way, we've all used Zoom as more than we want to in the last few years. Raise your hand. I'll keep an eye on raised hands and I'll sort of I'll allow you to unmute yourself and you can ask questions using voice. That's actually not a bad idea. Otherwise, you're you're listening to my voice for the next 60 to 90 minutes. If some of you want to ask questions using voice, it gives everyone a break from listening to me. As much as you might love my voice, um, those of you who are watching this on some other social media platform, you can ask questions in the chat and discussion bots and I I'll keep an eye on it as well. Um, I'll try to keep an eye throughout the session so that I answer questions as they come in. If I miss any, I'll make sure I'll answer them in the Q&A at the end. Good. Hopefully that all makes sense. Um, I'll check my Yeah, everything fine. Let us therefore make a start. I'll keep an eye on all of my chats. Um, I have two screens. This is one of those things where I wish I had three screens because I have lots of things in front of me, but I I'll make do with two screens for now. Um, let me bring up both chats on my second screen, which you can't see them, but don't worry. Um, hello. I can see someone said hello there as well. So, uh, those on Zoom, you have the Zoom chat. Those on any other platform, it's whatever chat you have. If you're on X, if you're on Facebook, if you're um Yes. So, someone asked me if you're on Facebook, can you participate? So, if you're on Facebook, you can participate via the chat. If you want to ask questions, you can obviously you can write code along with me wherever you are as long as you can see me. To ask questions, if you're on Facebook or on X Twitter or on YouTube or on any of social media platforms, you can't use your voice, but you can type in the chat. However, if any of you prefer to switch to Zoom, you can do that. realpython.com/live will give you the link where you can click on it and uh um swap from wherever you are to Zoom. Whatever you prefer, it's perfectly fine. Okay, let me I've got a warning there coming up. Um Oh, I've never had this before. I'm being told to confirm my speaking language. Uh there we go. English. It is English. Yes. Um there we go. Zoom comes up with something new every time. Okay. Let's make a start. It's uh 8 minutes past. Um let me jump to my coding platform. Now, it doesn't matter where you're coding. I'm using PyCharm. You use whatever you want to use. It doesn't really matter. Um hopefully you have something in front of you where you can code. As long as you can code in Python, that's all you need. Okay. Um, let me make that a bit smaller. Uh, yeah, someone told me more monitors. Yes. Um, oh, I think I know who told me more monitors for this word. Hello. If it's the person I think you are, our project, we're going to work mostly in a project. I need to tell you what the project is. Um, who loves doing chores here? I'm sure not many of you. Some people like doing chores, right? Anyway, let's assume we don't like doing chores. So, I'm sure you've been in a situation where you have a number of chores, a number of people, and you need to figure out how to share them equally. So, in the first part of the we're going to start simply, and then we'll make it a bit more complex later on. We're going to write a program to solve your problem forever. Whenever you have chores, we're going to have a program which asks the user to type in, we're going to start by typing in five names. Let's assume there are five people. So, the program will say, "Can you type in these five names?" And you type them in. Then it will ask you to type in five chores, and you type them in. Take the bins out. Uh, wash the dishes, clean the windows, whatever. Take the dog out for a walk. I have no idea. Um, and then it's going to assign randomly a chore to a person. Then we'll make it a bit more complex. We'll make it a bit more flexible. So, that's what we're aiming for. A reminder, this is a Python 101, so I'm not going to assume you know anything. I'll take it step by step. I'll start quite slowly, but then I'll pick up pace as we go along just because I don't want to uh I want to make sure that those who've never done encoding before are comfortable moving along. Good. I'll keep an eye on raised hands on Zoom and the two chats. So, um greetings uh um wherever you are. Um perfect. Good. Let's get started. Now the first thing we need uh a reminder first of all when you're programming you are both the programmer but when you're testing your program you're also the user. So you'll hear me switch between you as a programmer and you as a user. Here we're going to write our program and then when we run the code we'll see what it looks like as a user. So what's the first thing we need to do? We need the program to ask whoever is using the code to type in the name of a person. We'll start with one person, right? And communicating between the program and the user is something that happens all the time in programs. And one of the functions we uh tend to use for this is a function called input. I'm using the term function. Forget that. Let's leave the terminology for now. A command called input. And this is how input works. I'm going to put we'll come to the punctuation in a bit. Right? So input parenthesis speech marks. We'll see what all of those are. type in the name of a person or type in your name colon. I've put a space there as well. I'll tell you why. Um that space makes it look nice and neat and important. What does this line do? So input is a two-way form of communication. It's going to take whatever is in the quotation marks. I'll tell you what is in the quotation marks in a bit. Um this is just so these words inside the quotation marks are not Python words. Python doesn't understand any of these words. Um, this is for the human being. So, this is what we call a string of characters. String for short. Input shows this to the user and it waits for the user to type something back in. Let's try it out. So, I'm going to run my code. This is a computer program already. Hooray. We're done. No, no, we'll write a bit more. Let me run this code. And in my editor, yours may be different. Uh, when I run the program, it's at the bottom of my screen. So at the top is me as a programmer looking at the code. But when you use a program, you normally don't see the code, right? So you'd only see what the user sees. In this case, it's simple text. But I'm going to leave my screen split into two. Whatever editor you're using, you probably have something similar. Type in the name of a person. The program is prompting the user to type in a name. And I'm going to type in my name. I hit enter. And that's the end of the program for now because that's all there is, right? There's one line of code. Okay. Input output. Input showed this text to the person and allow the person, me in this case, to type in my name. Question, where does this name go inside the program? And here is one of the most important topics in programming early on. Every bit of information we have, every bit of information needs to be stored somewhere in our computer program. Why? Well, because we need to use it later on. There's no point in having information. Whatever that information is, in this case, it's a name. It might be something more complex. I need it to be stored somewhere. And the way we store information in a program is as follows. I can come up with some label. I'm going to call it name. But this is not a special Python name, right? So, if you want, you can call this whatever. Don't let's use names that are descriptive. But this is to point out that this could be anything you want. But let's call it name or person's name if you want an equals. And this means whatever comes back from input this command or function as we will call it whatever comes back from it. So whatever the user types in and hits enter is going to be stored in the variable name variable technical term get rid of it. I'll come back to it in a bit. What is this? Imagine this is a box. You have a box on a shelf. Whatever comes back from input, which is the characters sen or whatever you type goes inside the box, this is the label you stick on the outside of the box. So that from now on, whenever you need to use what's inside this box, you can simply use the label of the box. This is a bit like when you have boxes that say you're moving house, you have boxes, one says kitchen stuff, one says workbooks, whatever it is. The label tells you what's inside the box. That's exactly what a variable is. Good. Um, before we run this code again, let's have a look at another really common function in programming. And this one is called print. Same pattern. You notice name print followed by parenthesis. We'll see this often. Um, this means something is going to happen. When you have something followed by parenthesis, it means Python is going to do something. What do I want to print? Um, I don't want to print Steven. I want to print whatever is stored inside the box called name. Let's try it out. I'll run the code again. Um, let me go for Bob this time just to make And there we go. It prints out Bob. Input output. Um, I told you I'm starting slowly, but I'll speed up in a bit. Now, um, incidentally, I have quotation marks there because I want Python to take these letters literally, these characters literally. Here, I do not have quotation marks. What happens if I put quotation marks? I'll let you think for a few seconds before I run my code. Type in the name of a person. Let's go for Kate now. And it prints N A M E because the quotation marks means take these characters literally. It's not the it's not the label inside the program. Now we're saying these are the characters N A. That's the difference between something in quotation marks and something not. Anything which is not in quotation marks is something Python understands. input print and after line one names is also a label Python understands. So far so good. I'll keep an eye on any questions on any raised hands on Zoom but if not we'll move on. Okay, I told you we have five people not one. Now what can I do? If you are coding along with me do not do what I'm going to do next. Do not do this at home as they say on TV. Um I could do the following. One, two, three, four, five. Copy paste. We all love copy paste, right? Not in programming. In programming, you almost never want to do this by you never want to do this. You very rarely want to copy paste anything because that's a waste of energy. It's a waste of time. We love to be lazy in coding. But lazy in the good sense of the word, efficient. So whenever there's something that looks repetitive, Python has a way of doing it which is much better. It's not just to save you time. There are many reasons why we want to be efficient and I'll mention some of them as we go along. Okay. So, how am I going to convince Python to repeat this line five times without copying and pasting it five times and there are several ways of repeating stuff in Python. One of them is the following. I'm going to write this line. It's going to look a bit weird, but then I'll explain it. I'm going to say four. I'm going to start with the keyword for. In fact, we call this a for loop because it starts with four. F O R, not F O U R. Now, I can put any word I want here. In the same way that this could be anything I want, I'm going to call it repeats. But once again, this could be anything, right? There's nothing special about it. In and now this is the line that's going to tell Python to repeat something. I need to give it something with a number of things to repeat through. That didn't make sense. Um, let me write this down. I'm going to use here another command called range. And I'm going to put range five. And what range five does is it gives me five numbers. And I'm going to say repeat for each of those numbers. If there are five numbers, I'm going to repeat five times. And you might think, ah, the five numbers must be 1 2 3 4 5. No. U Python is weird. It's 0 1 2 3 4. But you know what? It doesn't matter here because we're not going to use these numbers at all. All we need them here is to have five things because I want to repeat something five times. Now, you can see some squiggly red lines there. That's never a good sign. So, first we need a colon at the end of this line. I'll tell you what the colon does in a second. In fact, I'll tell you what it does. Now, this line, let me translate it from Python to English. This line says, "Hey, Python, can you please, please, please repeat?" And not because I have repeat there, I could have written anything. Um, can you repeat the following lines five times because there are five numbers? And the colon means here are the lines I ask you I want you to repeat. But how does Python know which lines to repeat? Does it repeat one line, two lines, the rest of the code up to line 10,972? Well, Python doesn't know which lines to repeat. So, we need to tell it which lines to repeat by adding this space at the beginning of the line. We call it an indent. You can press the tab key. Probably whatever you're using puts four spaces there. It doesn't really matter how many spaces you have. We tend to put four in there, but just press tab and it's easy. And this gap, it's not just to make it look pretty. This is actually Python syntax for after the colon, any line that has this indent, that's the one I want you to repeat. So, for example, do I want to repeat print name? Well, let's say I want to show the names every time. So, in that case, I want to take this line and push it inside the for loop by adding a tab. Now, all of those lines have an indent. Incidentally, blank lines don't mean anything, right? So, you can have this blank line if you want or you can remove it. Let's check that this works. I've run the code again. Type in the name of a person, Steven, and it prints Steven. Now, let's pause here. Line one says, "Please repeat the following lines five times." Then line two gives us that. Type the name of a person. I type Steven. Hit enter. The name Steven was stored in the variable name. Remember the box with the label name. We move on to line three. Print simply regurgitates stuff out. It shows me what name is Steven. But the program did not end because I said repeat five times. So it's gone back to line two. Type in the name of a person. So now I'm back on line two. The second time let's go for Bob. It printed Bob third time. Kate printed Kate. Now it's asking me the fourth time. Uh Sarah. Now it's asking me the fifth time. Uh I don't know, Matt. Notice how it's different now. Once it showed me Matt, it didn't ask me to type in the name again. This is the fancy way of Python saying I'm done. I've finished your program. Hey, well done. So that is our for loop. We're repeating something five times. We're asking uh input output. So the the computer is showing us some text and waiting for us to type something in. We store that in a variable because we want to use it later on. In this case, I'm only using it on the next line. But I could use this on line 500 of my code or wherever. As long as I haven't changed this name will remain whatever it's showing there. Good. Um there's a bit of a subtlety there but we'll we'll we'll skip on that because we can't we can't cover everything today. So as you explore more you learn all of these subtleties. We might come across it later on. Okay. I have a problem now. I input five names. Where did I store them? I stored them in a box labeled name. But here's another important point. Any label you use, such as name, you can only use it for one item. So the first time, Steven went into a box labeled name. So far so good. The second time the loop ran, Bob went into the box called name. Unfortunately, Steven went out in the bin. It's no longer stored in our program because I can only have one box called name. So the second time the loop ran name was Bob. The third time name was Kate, then Sarah, then Matt. So now if I I'm not going to run the code again, right? Because I have to type lots of names. But if I had to print name at the end, notice that there's no indent here. So this line will only happen after the for loop finishes running five times. the label the the box labeled name will now have Matt in it which is fine for Matt but not fine for Steven Bobcat and Sarah. So this doesn't work. We need to do something else. Let me get rid of print name. I'll keep an eye on any questions or raised hands but that's fine. So how am I going to store five names not one? I can create another variable. variable was something like name, right? The box and the label we put on the box. So, I'm going to label this box people. Again, you can call this anything you want, right? You can call it whatever. People is descriptive because it's telling me what's inside the box. It's going to be many more than one person. Notice the squiggly red line. This is actually quite Let me run this code. Now, squiggly red line is never good, right? That's what teachers do. Underline in red, right? Let's run this code. and we get an error. Um, again the error is in red. Um, and we're told translation I have no idea what people is. Python looked for the name people and said this is not a word I know. It's not range or input or print things it knows and it's not something like name which I created. Now in this case it's not a problem because I'm going to put the equals and that means don't worry Python I'm going to tell you what people is. Now, here I'm going to put square brackets, open close square brackets with nothing inside. And this in Python creates what's called a list. A reminder, this is the square brackets, not the round brackets, parenthesis, not the curly brackets. In Python, every type of brackets has its own meaning. So, it's really important we use the right ones. I know it's more of a hassle to type in square brackets than than parenthesis, but square brackets this. It's actually easier to type in square brackets, right? In any case, square brackets, please. This creates a list and as the name says, a list is going to contain a list of things. So, now we can put more than one item in the list people. We'll see how we're going to do this in a bit. So, so far that's an empty list. There's nothing in it, but it's a list that can contain many things. Let me get rid of print name here. I don't want to print the names anymore. Instead, what do I want to do now? Every time the user types in a name and hits enter, yes, we're storing it in the variable name. But I also want to put this name somewhere else. I want to put this name inside the list people. So, how can I do this? And this is another important syntax in Python. People is the name of the list. Whatever I called it, you may have called it something else and that's fine. A punctuation mark you see often in Python is the dot. And you may notice on my editor and this probably happens on yours as well. And if you're using somewhere where you don't see this box, I would suggest you code in an environment which has this tool. Why? Because this is showing me all the things that Python can do with lists. It recognizes that people is a list. So when I do the dot, it says here are all the things I can do. Rule number one for now, ignore anything that looks weird starting with these underscores. We don't need them. Not yet. Anyway, this leaves a number of other things and these are the things you can do with a list. And I'm going to use append. Why? Because I want to add something, append something to the end of the list. Notice um I didn't I was lazy again. Let me do this again. I started typing a There you go. That's enough. Hit enter. Autocomplete does it for me. Including those parenthesis. We've seen them already. Input was something that had parenthesis. You may recall I told you this does something. It means it's going to do an action. Append is the same thing. The only difference between input and append well apart from what they do is that append is attached to the list. Append is something that lists can do whereas input just works everywhere. So inside the brackets what do I want to append to the list? Whatever is in name. So now Python is going to look what's inside the box called name. it will be whatever name it is and it will add it to the list. Let's also print the list people after the for loop. So notice there is no indentation. Why you you can do that but then it's going to print the list as it grows every time. I just want to print the list people once once I finish typing in all the five names. Let's run this. Type in a person uh Bob Steven number two. Note that now I've removed the print name. So, it's not printing the name anymore. Kate, Sarah, and I don't know, uh, James. That was my fifth time. After the fifth time, Python said, I've done this five this five repeats. I've done the loop. What do I do next? And the answer is print people. And you can see that it showed us a list. The square brackets are there just like the ones we used to create the list, but now list is not empty anymore. It's got Bob, Steven, Kate, Sarah, James. Those eagle-eyed amongst you may have noticed that I've used double quotation marks here and single quotation marks are shown here. What is the difference? In Python, there is no difference. You can use double quotation marks, you can use single quotation marks. It's up to you. And Python will always display them as single quotation marks, but many people prefer to use double quotation marks. It doesn't matter. Use whatever one you like. Good. Um, I had a question earlier about the error. Um, Oscar, I'll come to that question in a bit. I'll I'll try to remember when when I get my next error, which I'm sure I will, um, I'll answer your question in brief. So, I have I haven't I've seen it just now. The question is, how do you locate or trace where the error comes from? When I had an error, I'll I'll I'll I'll put in an error in a bit and I'll answer that question. Good. Now, in 30 seconds, I'm going to give you some work to do. I'm going to get you to write some code. We'll only stop for a couple of minutes, right? So, here's what I'd like you to do. So far, our code prompts the user to type in the name of a person five times and then it's importantly, it stores those names in one place in the list called people. Our program also needs five chores. So, what I'm going to ask you to do in the next two minutes, I'm only going to give you two minutes because um I want to keep moving with the workshop and also it's not too difficult what I'm asking you to do. I'd like you to do something similar for the chores. So, I'd like you to get your program in addition to what it does now. So, don't remove what you've done now to ask the user to write a chore five times. and importantly to store each one of those chores somewhere in the program. Happy with that? We'll go for 2 minutes. On your marks, get set, code. I'll write the task here as well. Um, and I'll be quiet a bit to give you a break from my voice. We'll go for another minute. Um, I'd like to give you more time, but it's finding the balance between giving you some time to try this out and flex your fingers, but not uh keeping the momentum going. So, another minute or so. H. Okay. Again, apologies for giving you only a short amount of time. Um, but you may have noticed that this task is very similar to what we've done already. So, what do we need? We need a place to store the chores. Um, and you could create another list. Now, uh, common question. Oh, I did not put this there. You know, maybe you've put it there. Does it matter where you create the empty list chores? Yes and no is the answer. There's never an easy answer, right? It needs to be before you want to use it. Let me do this with people. Um, I created people before I used it on line six. Now, doesn't matter whether chores is there or later on as long as it's before you use it. Often we create these together so that it's nice and neat. So, I'm going to create it up there. I'm going to do this the long way, but there's a short way as well. So, the long way is to create another loop. This gives us a bit more practice. for I'm going to call this something now. You can call it repeat if you want and I have a question from Joseph and I'll answer it in a second. I'm just going to create something else, right? Just just to show you it's a different name. Doesn't matter. In range five, what do I want to do here? I want to say um create a box. Let's call it chore. You can call it whatever you want, but makes sense to create a descriptive name. Once again, I'm going to use input. Um, enter a chore colon. Um, I'm putting this space there. You may notice it there as well because a space is a character. Anything inside the quotation marks is characters. Just like I need a space there. If I put a space there, it means that when I start typing, it's not exactly against the colon. This is just to make it look pretty. And then I want to take my list chores. The plural one is the list which is currently empty. The singular chore is whatever comes back from input. So whatever you type chores append and this is why I only gave you a couple of minutes, right? Because it's very similar to what we did earlier. Chore I inside chores plural I want to append chore singular. And let's print chores as well. Uh by the way uh could you merge these two loops? Could you do just one loop and put them in the same? Yes, you can. In this case, we can because we're using five in both of them. I'm going to keep them separate just for practice, but you can merge them into one if you want. Now, I had a question. Um, where do we use the repeat or the something? The answer is in these loops we are not using it. So, we need to put something between four and in. That's how Python works. But you'll see that this will be different in a bit. Sometimes we do use this uh repeat is the numbers 0 1 2 3 4. So every time the first time repeat is going to be zero then one then two then three then four. We don't need these numbers. So we're simply ignoring it. Uh sometimes you'll see when we're ignoring this. You'll see people put an underscore there. You have to put something. An underscore is a valid label but it shows look I don't really care about this, right? I don't need it. But let's keep it um less cryptic. So in these loops, we're not using repeat, but we still have to put something in there. Uh literally something if you want or anything you want. It doesn't matter. Okay. Um let's try this out. Um and then I still have to come to Oscar's question. I haven't forgotten. Let me go a bit quickly. Steven, Bob, Mary, Jane, and Jake. You can see that those are the five names. Enter a chore. Um, uh, take the bins out. Clean the dishes if you don't have a dishwasher. Um, vacuum the floor, the carpet, or whatever. Um, take the dog for a walk. I might copy and paste these later. And uh I don't know something else. I can't think of it. Never mind. There you go. Those are our chores. The last one is very very descriptive. Good. So far so good. I'm going to pause here in case I'm going to answer Oscar's question, but if others have questions, a reminder, those of you on Zoom, feel free to raise your hand and you can use your voice. Give me a break. Um otherwise, you can use the chat either on on Zoom or wherever you are. Um yes, we could type numbers as our chores. Um you're right to make it simpler. The first time I wanted to in any case doesn't matter. Um let me go back to remember when I had an error. Let me put in a deliberate error here. For example, um I've forgotten that. Can you see that closed parenthesis? I've forgotten it or you know whatever. And if I run my code, I'm now going to get an error. Now I'm not going to talk too much about error messages. This is we can't cover everything in one session, right? But this is something that you learn very early on in coding. How do I deal with error messages? And there are two places to look for. The first line here, it gives me a line number, line five. And in fact, if in my uh editor, if I click on this, can you see the cursor went to line five. So the problem is on line five. And then the bottom line gives me a bit of information. Now, sometimes this information is very helpful. In this case, open parenthesis was never closed. Ah, yes, there you go. Sometimes you need a bit of practice to understand it. But that's how you deal with error messages. And the error always has a type. For the time being, don't worry too much. But syntax error means we've done something wrong with the grammar, with the punctuation, with the syntax. There are different types of errors. We may see some later on. So that's Oscar in a nutshell. How you deal with errors. Look at the line number and look at the error. It's not always that simple, I have to say. But in this case, it's nice and easy. Good. Um, before, let me get rid of this. Uh, by the way, I forgot to mention this. Uh, while you were coding, you may have noticed I've written some notes for you. This was the tasks asking you what to do. And I've started these lines with a hash symbol. It's not a hashtag. It's a hashtag on on Twitter or whatever. It's a hash symbol or it has many names. And anything that comes after the hash symbol, Python simply ignores. So there are two things we use these for. Either to write notes or comments. In this case, I was writing instructions for you to read. This is plain English for you to read. Python ignores it. Um, in this case now, just to keep things nice and easy, I'm going to delete those. The other place we might use the hash symbol is let's assume I've got this line and I don't want it anymore. I could delete it. Or if I don't want to delete it because maybe I'll change my mind later on, I can put the hash symbol in front of it. And this means Python is going to ignore it, but it's still there. If I want to bring it back, I don't have to type it in again. Lazy is good. Remember, okay. Um, before I summarize what we've done, let me push on a bit further because what do we need to do next? Now, we need to start assigning chores to people. And here's an important mindset for when you're coding. This is true for any program you're ever writing. Before we we've already written some code right here. But before you type in code, you want to think how would I as a human being solve this problem without computers, without coding. Play along with me here. Let's assume we don't have a computer and we're like, okay, we need to solve this problem. I'll take a sheet of paper and I'll go to the five people. I say, what's your name? Bob. What's your name? Kate and I'll write them down in a list and then I'll say what are the chores we need to do take the bins out whatever so I've got two lists I've written them by hand and then I'm going to go to the first person in the list Bob and somehow find a way of choosing one of the chores at random close your eyes and stick your finger or get a dye and roll it or what whatever you need a random way of assigning chores and then Bob take the bins out and you keep doing it until you get to the end that's exactly what we need to do sounds Easy. The challenge in coding then is to translate that from ideas into Python code. So let's see how we're going to do this. I need to I've already got a list of five names, right? Um people is an empty list, but by the time we've done lines four to six, we've got five names in it. So I've got I need to go through each one of those names. How can I do this? This is a repeat problem and for that we have the for loops. So I can use a for loop to go through each and every name in the list of names. It's going to be similar but not identical to what we've done before. Let's see why. For loop starts with four. Again I can write whatever I want here. Right? Let me say person. This time we are going to use this. So here doesn't really matter what you do here. I want to use something descriptive because we're going to use it in. Now I do want to repeat this five times but really I want to repeat this for each and every name in my list people. So I can say here for person in people. Sounds weird right? But makes sense in Python. People whatever you put at the end of this line needs to be something that already exists in Python. Here we used range which is a a tool that exists in Python. A tool that gives us five numbers. In this case here I've used people. People is the label of the list. It exists. However, the first label the one we put in between four and in we are creating it there and then. So this is a name that we're inventing right now. And this for loop works in a similar way. But now the label person will be Steven the first time, Bob the second time, Kate the third time or whatever the names are. Let me show you this. Let me print person. Person is this label we've invented on line 16. So let me run the code. Um I'll go a bit quicker now. I'll type in the name Steven Kate. Did I type it wrongly? Yes. Kate, Bob, Max, and Matt. And the chores, I'm going to do one someone suggested, right? I'm going to keep it simple just because otherwise I'm typing for it long. And notice what happens. Let me make this bigger. After I finished entering the chores, lines 161 17 repeated print person for each and every person or for each and every item in people. Steven, Kate, Bob, Max, Matt. So I'm using the for loop again, but now in a slightly different way. Four loops are great whenever we need to repeat stuff. Now, this is not what I want to do. However, what I want to do is I want to assign a chore to person. And here is where I need to pick at random. And this is another important um point. Uh let me let me leave print person for now. I'll remove it later. We need to find a way to ask Python to pick one of the chores at random. Now, so far every command we've used is something that is built in, always present in Python. We use words like for and in and range and input and append. Um, and append again and that's pretty much it, right? Um, there you go. That's everything we've used. Um, as you learn more Python, you learn more of these essential tools. But Python has a vast array of tools and sometimes they're not directly available to you but you need to fetch them from from the bookcase say or whatever from the library. It's like you're going to library and fetching a book and then you have all the information in that book. How do we do this in Python? Now by convention we always do this at the top of the code. It doesn't have to be but we always do it. And we're going to use the keyword that's called the command import. Import means this does bring from the outside, right? And we're going to there are Python has lots of these. We call them modules. We're going to use one called random. No prices for guessing what it does. So the random module um the random set of tools contains things we can use to do random stuff. Now I'm going to remove. So right at the bottom there inside the four person and people I'm going to say from this random module this random set of tools I did tell you we're going to use the dot a lot right so here's the dot and this is showing us what's inside random and you can see there are quite a few things right um um doesn't matter we're not going to look at them all I'm going to use the one called choice not choices choice because I want to choose one item notice similarity it's very similar similar to how append works or input. It's a lowercase word with parenthesis. This means it's going to do something. Um, random is where choice is found, right? Because it's not there lying anywhere we can use. We have to fetch it from the random module. Now, what goes inside the brackets? What do I want to choose from? In this case, I want to choose from chores. Reminder, chores is the list of chores which is empty on line four, but by the time I've done lines 12 to 14, I've filled the list. Now, same as with input, you may recall input gave us something back to the program. And I told you it's important we store this because I need to use it later in the code. And that's what chore equals did. We stored whatever came from input in a box labeled chore. I need to do the same thing here. Um, we can call it whatever. So, so equals. And now I need to come up with a name. Now, you can come up with a unique name or I'm going to be lazy. I'm going to reuse this name. Why is it okay to do this? Because I no longer need this chore. This particular label, I only needed it to go from line 13 to line 14. As long as I'm comfortable that I can override that, I can now reuse the same name. Um if not give it some other name random chore. Uh there are some rules on naming things. Uh one of them is you cannot have spaces. So normally we'll put an underscore if you want if you want to call it um random chore. We can't put a space. So either you put nothing or typically you put an underscore. But I'm going so you pick whatever you prefer. I'm going to reuse the name chore just for brevity. Okay. Line 19 will choose one chore at random. So now the label chore has picked a chore at random. What do I need to show now? I need to show something to the user. Don't write this line yet because I'm going to change it. Ideally, what do I want this to look like? I want it to look like something like this. Um, Steven needs to take the bins out. But I do not want to write that. Why? Because first of all, I don't know whether Steven is one of the people, right? It depends what you type in. Also, I want to go through each person. So, this name will depend on what the user input and it will change for each of the five names. So, let me put three dots there for now. I need to change that needs to take the bins out. Same problem. I don't know what the chores are when I write the code and I want to go through all of them. So, these need to be placeholders. I somehow need to convince Python to fetch the right thing and put it in there. Now, we've mentioned strings, the string of characters that are in quotation marks. And Python has uh another version of the string which is a bit more powerful. And this is called an F string. No, you you will never guess why it's called an F string. There we go. Um we've put an F in front of the quotation marks. The F stands for formatted strings. So this allows us to play a bit more with these strings. Let's see how. Instead of this three dots, I'm going to put a set of curly brackets or braces. Remember the brackets you use are important. These are the call them whatever you want, right? Depending which part of the world you are, you'll call them uh curly braces. You'll call them par curly brackets, braces, whatever it is, those ones, the squiggly ones. And this tells Python the f in front of the quotation marks and the curly brackets says whatever is in the curly brackets I want you to go and fetch this information. So for example I want to say here this is whatever is inside the box person. I have to do this if I just type in person in a normal string. Python will type p r s o n. I don't want that. I want Python to fetch what's inside the box labeled person Steven Bob Kate and put that there. These are fstrings. And then the same thing there instead of those three dots which I was just putting there temporarily curly brackets. And now I want this to be chore which is the label I've just created on the line before it. Let's try this out. So, Steven, Bob, Kate, Mary, James. Those are the names. Chores. Take the bins out. Clean uh I can't type anymore. Clean the dishes. Um vacuum the carpets. Um take dog for a walk. And I can never think of another one. Um, I don't know. Um, make the bed. There you go. And now we have the names are in the order I've typed them in. Steven Bob, Kate, Mary, James. Steven, Bob, Kate, Mary, James. Why? Because I'm looping for person and people. I'm going to the names in order. But, and you may notice we have a problem here, right? Steven needs to vacuum the carpets. Bob needs to make the bed. Kate needs to take the bins out. Mary needs to take a dog for a walk. So far, it seems like we're lucky, but James needs to take the bins out again. See what's happening here? I am picking a chore at random, which means that if I'm unlucky, which I'm I'm I'm bound to be unlucky, um the same chore is assigned to different people. That doesn't work, right? um we don't want that. So what do we need to do? This is where we need to think of all options when we're writing code. When we pick a chore, um yeah, sorry, I'm trying. The dog would be hurt if he knew they would be taking him out for a walk, maybe. Um every time I pick a chore, what do I want to do? I want to remove it from the list so that it doesn't come up again. So I want to take my list called chores. You recall how earlier when we had a list, we could append things. We could add things to the end of them. Now I want to do the opposite. You put a dot there. And if you look through um you can see that there's one that's quite useful there. Remove. What do I want to remove? I want to remove chore. So what I'm doing here, I'm picking a chore at random and storing it in the box called chore. But then I'm removing it from the list so that when the loop repeats again, the chore that has already come up cannot come up again. I'll let you run this code and try it out. Um, it's exactly the same as before, but now we're guaranteed that each task will only come up, each chore will only come up once. Um, I got your point. Yes, taking the dog for a walk is not a chore. It's a privilege, right? I don't have dogs, so apologies for that. Um, no offense is meant to any dogs. Yes, taking dogs for a walk is a pleasure, I'm sure. Um, I should have picked up another chore. Good. Let me pause here for a bit. Um, I'll add a bit more. Um, yeah, we're okay with time. Um, I'll I'm aiming for an hour and a half, right? So, let me pause here for a bit because we've covered a lot, right? So we've looked at how we can import these modules. This is where Python has lots of useful functionality. But sometimes you need to bring it in in topics, random other topics. You know, whatever you want to do in Python, you're going to find a module somewhere that has all the tools you need. Python is a broad language. U then we created lists, these containers that can contain lots of items and we label them. These are the variables. So people is a name we chose for this list. Chores is a label we chose for this list. Then we have the loops. The for loop allows us to repeat something over and over again. If I use range five, which is five numbers, it just means repeat five times. Repeat that five times. The indent, this gap, this the space we have at the beginning of a line is what tells Python after the colon, it means here's a block of code and all the lines that come together with an indent. These ones, oops, there you go. Lines seven and eight are grouped together because they both have the indent. That means these are the lines that are part of the for loop. You say these are the lines we'll repeat. Notice that the next line with code doesn't have the indent. Once again, these are the lines that belong together. In this case, I have three lines. You can have as many lines as you want. As long as they all have an indent, they are one block. So, we've seen the for loop, we've seen inputs, we've seen commands, we've seen quite a bit here. Before I move on, we're This is nice and neat, but you need to have five people and five chores. What I'm going to do next is to make it a bit more realistic. You can have as many people you want and as many chores as you want, but let me pause for a bit um to tell you about I promised I'll show you where to get resources and a few other things. So, let me use this as a um I promised I'm going to share with you resources and that's where you can find them. realpython.comward slash welllive/goodies. I'm doing this but you might be seeing the other way around, right? Anyway, you know where forward slash is. Um and on this page which I'm going to show you, you're going to find um I'll come to this in a bit. This is the surprise I was telling you. Let me hide it. Uh these are the topics we're discussing, right? Um input, output, um lists, for loops, frings. We haven't yet seen these two, but we'll come to them in a bit. Um uh if you prefer to read tutorials, you have a tutorial about the topic. If you prefer to watch video courses, you have video courses. So, if you want to on each of these topics go a bit deeper and explore further, uh here are some resources for you. Um, you'll also have the code I'm writing. Um, it's a more advanced, so I I won't spoil it. I won't show it to you now. And there's also going to be a link to the recording at the bottom um once Zoom decides to process the recording. So, this is where you can get everything. And to to thank you for joining us, uh you get a a 7-day free trial um for real Python, so you can make the most of it. uh the tutorials are available to everyone but the video courses are available for members. So with your do uh with your 7-day trial you can go to video courses etc etc and I'll tell you about the forum later on because I'm going to give you some homework to do and then we can discuss it on the forum uh in your 7-day trial. So this is where you can get everything you need. I'll show you the link again. I'll show it again at the end. Right. So, realpython.com/live/goodies. Good. Um, I'll come back to this later, so don't worry. Uh, those of you who are on Zoom, you've registered, so we have your email, so I'll send you an email today or tomorrow with these links. Those of you who are watching on social media, well, well, make sure you write it down. Um, if you forget it, you can find me on social media or contact Python and we'll give you the link, of course. Good. Let's go back to our coding. So, we're on the hour. So, I'll I'll I'll go a bit quickly in this next bit. Um and and then I'll give you some homework to do and we can discuss it after the session. What do I want to do now? I would like to make this a bit more flexible so that we can put in as many people as we want and as many chores as we want. So, for the time being, let me get rid of this code, but I don't want to delete it, right? Because I'm going to come back to it later on. Remember the hash symbol. Now, here's a shortcut, and this works on almost any editor. So, whatever you're using, this is probably going to work. I've selected all the code I want to comment. I want to put a hashtag in front of it. I'm too lazy to go and put a hashtag in front of each one. uh control question mark or if like me you're on a Mac command question mark puts a hash symbol in front of all of them. This is a good way of commenting out all that code and when you want to bring it back you select it again and once again if you're on Windows it's control question mark. If you're on a Mac it's command question mark and magically it comes in. So you can toggle it in and out. Shortcuts are great. We love them. Uh, I'm just checking no raised hands and dealt with all the questions so far. Okay. So, I now want to be able to put in any number of names. So, I can't use this, right? Because here I have to put a number five, 7, 10. I want the user to decide. Let's have it as follows. In fact, let's let's change this. So, I still want to repeat lines seven and eight, but now I don't want to repeat them five times. I want to repeat repeat repeat them for an indefinite amount of time. What do I mean by this? The program doesn't know how many times to repeat them. It's the user who's going to decide I'm done filling in names. So, I cannot use the for loop anymore. But we're still going to use another type of loop. This one starts with the word while. Can you guess what we call it? You guessed it. It's the while loop. Now, the while works a bit differently. It doesn't have the for something in something. Instead, it needs to be followed by something that Python understands is either true or false. And for the time being, I'm going to actually write true in there and put a colon. The colon is still there. You'll get a pattern of where we use the colon. Notice that true is an uppercase T. So far, this was the only thing that uppercase. There are more things that are uppercase in Python, but today this is the only thing. These things matter. In coding we need to be very precise the type of brackets the uppercase lower case true is a capital T. How does this work? I am not going to run this code and if you have run your code I'll tell you how to get out of it because while the while loop will keep repeating this chunk of code for as long as whatever is after a while Python understands is true. But in this case I've actually typed in true. So this would always be true. So if you run this code, Python will keep repeating lines seven and 8 forever. In fact, let me run this code. Now I have no way of getting out of this loop. Uh, Ctrl C normally does it or um depending on what editor you have, you might have a cross or a stop, you know. So there's always way of stopping it. Ctrl C is normally uh works everywhere. So this is what we call an infinite loop. We don't want that. So let's work on this. I want this to be something that starts off as true because I want these lines to happen. But at some point I want to be able to switch it off, make it false. Since the user cannot come and change the code, that's the whole point of a program. We cannot do this, but we're going to do something very similar. Let me create another variable here. Um, I'm going to call it keep going. A reminder, we've mentioned this before. I can't have spaces in names. So, I'm putting an underscore there. It can't be a hyphen. It has to be an underscore. Underscore is the only symbol you can put in there. Um, it's underlined in red. We've seen why because this doesn't exist. But equals will solve this problem. And I'm going to So, I've got a box labeled keep going. What am I going to put inside this box? I'm going to put in true. The same true I've typed in there. So now I have a box labeled keep going with true inside it. Why? Because now on line 8 instead of while true I'm going to say while keep going. And if you follow this you might think what's the point of this? If keep going is true why do I have to change this? And the answer is that keep going is a variable. I've used the term variable before today. There's a clue in the name. A variable can vary. It can change. And that's why we need it here because at some point I want to change what's inside this box to false. And therefore every time this repeats it's going to come back here and check what keep going is. The moment it's false it's going to say okay I'm done. How are we going to do this? Let's say that we're going to ask the user when they finish typing in names to just hit enter. So whenever they have typed in a name of a person if they just hit enter without typing anything it means they finished inputting names. just to keep it simple. So we have a a new challenge here. Every time line nine happens, the computer says type in the name of a person. The user types in a name and hits enter. I now need the computer here to make a decision. Computers make programs making decision is something that happens a lot. I need the computer here to decide is this a blank string that did the user just hit enter without typing anything in or is there an actual name? So to get the computer to make a decision, I'm going to use the if keyword. And if does in Python what it does in English, I want to say in English I'd say if this name is blank, do something. Otherwise, if it's not blank, do something else. And the way I say this in Python is if name, that's the label I've just created there, equals the empty string. Remember that the quotation marks are a string, but I've put nothing in that string, not even a space. A space is a character. So, there's just quotation marks stuck to each other. This means it's a string that has nothing inside it. Just like this list was empty, but this is a string that's empty. And then I put a colon there. We've seen the colon a few times already. If I hit enter, can you see that automatically my editor put this tab? That's the same this indent. That's the same reason. If the name is empty, what do I want to do? I want to take whatever is in the box keep going and change it. Remember, we can only have one label called keep going. So the moment I say keep going equals false, whatever was in it before, true is thrown in the bin. From this point onwards, keep going is false. So when the loop comes back to line 8 to repeat, it's going to say, "Ah, no, keep going is false. You don't want me to repeat anymore." And then it carries on with the code after the while loop. Now I'm going to pause here because I can hear some of you shouts, "Oh, Steven, Steven, you've got a typo there. You've put in two equals by mistake. That's not a typo. And let's see why Python needs to distinguish between one equals and two equals. We've used the one equals a few times. We call this an assignment. The one equals is when I have some information, whether it's true or whether it's whatever comes from input or others we've seen. And I want to put it in a box and store it and stick a label onto it. That's what one equals means in Python. double equals has a very different meaning. It's asking Python, can you check whether these two things, the one on the left, one on the right, are exactly the same thing. If they are exactly the same, give me true. If they're not, give me false. And that's how if is going to decide if this is true, then it's going to run the code that comes after it, the one with the indent. Else, if I spell it correctly. So if this is not true, don't bother with line 11. But instead, I want you to do something else. And this is what I want to do here. Notice the indents. Now it's a bit more complex, right? Because we have two layers of indents. While keep going, everything that's in the while loop has at least one indent. Lines 9, 10, 11, 12, 13. But some lines have more indents. Why? Because if name equals equals empty string colon needs to have its block of code. There could be one or more lines here. These will happen only if name is empty. And the same with else. In this case I only have one line but I can have more. So with Python we have to be careful with these indents. Okay. I I am going to run this code one last time and then I'll give you a task to do after the session and I'll tell you how we can how you can communicate with me after the session. Let's first check that this works. Um so now I only have type the name of person right. So Steven, Bob, Kate, Mary, Sarah, James. Notice I've already gone past one two three four five six. Let's put a second one, Matt. And let's assume those are the people we have. Now, without typing anything, not even a space, I'm going to hit enter. And notice how the while loop kept going until something happened. In this case, until I entered nothing. And nothing is an empty string. I should have printed people there. And then you would have seen that we have a list with all those names. You can do this yourself. Okay. In the interest of time, um I'm going to draw this project to a close, but I'm going to give you a bit of homework and I'll tell you how we can uh carry on the discussion after the session. So now that we've done this, I would like you after the session to deal with the chores. You have to do something similar with the chores. Now, we can have a different number of chores. You can have seven people and three chores or whatever. So, I'd like you to have a way of inputting all of these chores. So, you need to change this for loop where we're inputting chores. Again, something similar to what we've done here perhaps. And then I'd like you to deal with the final bit, the assigning of chores to people. Now, this becomes a bit more tricky because we have three options here. Either you have the same number of people as chores, and that's easy, or you have more chores than people, or you have more people than chores. Now, I'm going to ask you to work on only one of these because one of them is a bit trickier. And if you are, if this is the first experience with Python, we'll only do one of these. So, if you have more chores than people, ignore that. That's something you can work on perhaps as you develop your Python skills further. But if you have more people than chores, so the example I have here, right? Seven people and let's say we have three chores. See whether you can figure out how to change last part of our code to deal with all the seven people but fewer chores. Now, um that's your homework. Let me jump back to what I've shown you earlier. Um, we'll go to the Q&A now. So, I'll show you this again at the end. But now, um, I'll I'll see whether you have any questions for me, but um, a reminder, you get a 7-day free trial. And one thing you get as members of Real Python, and for 7 days, you'll be members, maybe you'll stay for longer, of course, is access to the membersonly forum. There's a forum. It's hosted on Slack for members to ask questions, communicate with others, etc. So, once you've tried finishing this code, um, if you like, I'd like you to using your 7-day free trial, come on the forum, post your code there. You can tag me. Um, remember, my name is under my picture there. I'll I'll I'll share with you later as well. You can tag me and we can carry on the discussion there. If you've managed to do it, post your code. If you're stuck, let me know and we can carry on the conversation on the forum. This is what happens every day on the forum. People are asking questions and us real Python team members or other Real Python subscribers are helping each other so we can carry on the discussion on the forum. A reminder that realython.com/life/goodies sends you here. Um you have some extra resources uh tutorials to read or video courses to watch about all the topics we've done. Um, I've actually not covered the rappel, but it's there anyway as a bonus. Um, now this leads me to the Q&A. So, let me uh let me for the time being go back here. Um, let me go back to I've got my second screen now. Um, you may have lots of questions, you may have few questions, you may have no questions at all. Feel free to ask any questions about either the project we're working on or your Python learning journey specifically. Um, if you're thinking of how to proceed, I'll I'll I'll help you as best as I can or how real Python works. There's no agenda in this Q&A. Anything you want to ask, you have me here for as long as you want. Feel free to ask me questions. A reminder, if you are on the Zoom meeting, um you can raise your hand and I'll bring you in. That gives everyone a break from my voice. No matter how much you love my voice, I'm sure you want a break from it. Um or you can post in a chat. There are two chats here. If you're on Zoom, there's a Zoom chat and I'll read it out for everyone else. If you're on any of the social media platforms, there are about 700 of you there. um you can post on whatever platform you're on and I'll be able to see it in front of me and I'll read it out and I'll ask the question. Um I have a first question from Sandra. So I'll read it out. It's on Zoom. I am preparing for ML AI using Python machine learning and artificial intelligence. Please share your inputs. Okay. Um my my first question would be are you brand new to coding um or do you already know a bit of coding before? So I'll answer both questions. Right? So since you're on this call, let's assume you're brand new to programming in general. Feel free to um let me know otherwise. Right? But I'll answer the question broadly. Any application you want to do in Python, you need to know the basics. You need to know the fundamentals. There you'd like me to tell you there's a shortcut. Here's a shortcut. Instead, I'm going to be honest. There is no shortcut. Um I often give the analogy. Imagine you're in a park on a lovely day and there's a tree you know a big tree trunk and then it's a big big old tree so there are branches branching out the branches branching out are the specialtities machine learning AI web development science data science the only way to get to those branches is to climb the main tree trunk and that's the fundamentals of Python things like we've done today and a bit more there is no shortcut um anyone who tries to get to the branches without going through the trees trunk will regret it later on. So um now in your case you've used Python before so then you've already started climbing the main tree trunk. In that case um we have quite a few resources on real Python to get you started on machine learning and AI tools. Um this this being u an intro session I don't want to spend too much talking about specifics of machine learning and AI but all of these topics uh feel free to have a look on on real Python if you are going to be join using the 7-day free trial go on the forum feel free to tag me and I'll post some links there as well um like with everything so with with when you get to applications such as machine learning learning and AI there are two things you need to know right there's the programming and then there's the other stuff the maths you need for ML and AI and uh of course here at your Python we can help you a lot with the Python and then you'll need to top up with all the other tools and this is true for many applications in programming often being an expert programmer is not enough you may need some other subject specific knowledge um I'm a physicist by training so before um so focusing on teaching Python I was a physicist. Lots of the code I wrote was in the domain of physics. I need to know how to program, but of course I need I need to know the physics as well. So often you have to merge the programming specific knowledge that's where we can help you and the subject specific knowledge which you need to get elsewhere. So hopefully Surand gave you a bit of a guide there and feel free to contact me and I'll send you some links of real Python resources specific to ML and AI. Um, Luben, I am a high school math teacher that enjoys coding on the side. I know the basics of Python. However, I find it difficult to stay motivated or find projects that I can apply to my daily teaching job. Any recommendations as to where to look and find more resources for teacher projects. Now, as it happens, uh, I spent 10 years doing Python for kids. Um, could I suggest you contact me separately, Reuben? Um, you'll receive an you've already received an email from me. So, you have my you're on Zoom. uh you have my email. Uh since this is very specific for coding for teachers, it's something I I do have experience with. Uh rather than answering on the call, if it's okay, I'll take it privately. But uh yes, um I've spent uh um a career developing Python resources specifically for teaching children. Um uh yeah, I that's all I'll say here. That's okay. But um contact me anyone else who's interested in that contact me and I'll I'll I'll guide you separately. Um sorry not I didn't mean not to answer it here but it's so specific and uh it will take yeah um I'll share quite a few things with you. Um good any other let me uh come back to my final page. Uh please do ask questions. I'll keep an eye if anyone wants to if anyone is brave enough, those of you on Zoom to raise your hand and ask a question, you're more than welcome. And those 700 plus uh still watching, thank you for still watching. If you have questions, you should be able to post them on wherever you are, X or Instagram or LinkedIn or YouTube, and I'll see them in front of me. Um, while you're thinking about your last questions, uh, there is one more there. Let me see. Let me Oh, no. This is a thank you. Thank you to you. Um, a quick reminder, um, the resources I've shown you, uh, to take the next step on all the topics covered today. Today was a a project that covered lots of topics, but we've covered them briefly. The for loop, the if statement, variables, there's a lot more to say about all of these topics. Um, feel free to have a look at these resources I've shared. Some of them are quite detailed, so you can go as deep as you want on all of these topics. And of course, there's many more at RealPython. And you'll find this page I'm showing you here at realpython.com/live/goodies. And there you'll also get your 7-day free trial. That will also give you access to the forum. Make the most of it. Uh a reminder that the video courses are only available behind the pay wall. So make the most of your 7-day free trial. Watch as many video courses as you want. And then of course you can also stay after the seven days, right? But anyway, um in this in this page, you'll also find the code. Now, do not cheat. I I've deliberately not scrolled down. Uh if I scroll further here, this is the solution of the code I was telling you to write. Don't look at this. Try it out yourself first and then come and speak to me on the forum and you can scroll down and have a look at a solution, which is my solution. Something that's quite important in coding, I didn't mention it. There's always more than one solution to a problem. And the more proficient you become, you'll find that you'll use different solutions. Um, also at the bottom of this page, not now, but uh later today, you'll have links to this recording. Um, I I ran two of these workshops today, one earlier today and one now. So, doesn't matter which one you pick, right? But pick the second one if you want to watch a recording of this one. So, once again, that's realpython.com/live/goodies. Before I check any last questions and and and if not uh send you to carry on with your day or night, next week, same time, same place, there's another different workshop. So, it won't be the same workshop, but it's still a workshop for beginners. So, if you want to do another 60 to 90 minutes with me, if you've not had if you've not heard enough of my voice and you want to hear another 60 minutes of me talking next week, it will be a different project. still Python 101 but a very different type of project. So um if you want you're more than welcome to come again next week. Um one last thing this was a question asked in the in the previous workshop earlier today. We will have so at the moment we have three of these beginners workshop today next Wednesday and then the Wednesday after yet another different workshop but we plan to run more of these workshops for beginners but also for other levels. So if some of you are here interested but weren't quite beginners, we will have similar workshops like these for intermediate and advanced topics and even more specific topics. So let us know whether you like them. Let us know what you're looking for. For the time being next week and the week after, we definitely have two more workshop. So hopefully I'll see you there. Before I wrap things up, any other questions either on Zoom or via anyone watching the streaming? Going once, going twice. In that case, thank you all for coming. Hopefully, you found it enjoyable, interesting, and useful. Um, for those who are joining the 7-day trial, I'll see you on the forum. Come and ask me questions there. And maybe I'll see you next week for another worship. Goodbye and thank you for listening to me.
Original Description
Join us for this 60 minutes free workshop for beginners. This is a hands-on session where you'll learn about Python fundamentals while working on the project
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from Real Python · Real Python · 0 of 60
← Previous
Next →
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
A better Python REPL – bpython vs python interpreter
Real Python
Introducing large-type.com – A Utility Website
Real Python
Reading Hacker News Without Wasting Tons of Time
Real Python
Forward References and Python 3 Type Hints
Real Python
Using Sublime Text as your Git Editor
Real Python
Python Code Linting and Auto-Complete for Sublime Text
Real Python
Make your Python Code More Readable with Custom Exceptions
Real Python
Write Better Tests with Sublime Text's Split Layout Feature
Real Python
How to Use Sublime Text from the Command Line
Real Python
Rename Variables with Multiple Selection in Sublime Text
Real Python
Sublime Text Settings for Writing PEP 8 Python
Real Python
Write Cleaner Python with Sublime Text's Indent Guides
Real Python
Sublime Text Whitespace Settings for Python Development
Real Python
Function Argument Unpacking in Python
Real Python
Python Code Review: Debugging and Refactoring "Conway's Game of Life" + Automated Tests
Real Python
Using "get()" to Return a Default Value from a Python Dict
Real Python
A Python Shorthand for Swapping Two Variables
Real Python
Python Code Review: Refactoring a Web Scraper, PEP 8 Style Guide Compliance, requirements.txt
Real Python
Click & Jump to Test Failures from the Command Line (iTerm2)
Real Python
Setting up Sublime Text for Python Developers
Real Python
Sublime Text + Python Guide Overview
Real Python
Python Code Review: Adding Pytest Tests to an Existing Python Web Scraper
Real Python
Type-Checking Python Programs With Type Hints and mypy
Real Python
A Shorthand for Merging Dictionaries in Python 3.5+
Real Python
Python Code Review Flask Web Security Tutorial + Virtualenvs, requirements.txt
Real Python
My Python Code Looks Ugly and Confusing – Help!
Real Python
Setting Up a Programmer Portfolio/Developer Blog – How To Get Started
Real Python
Do I Need a GitHub/GitLab/Bitbucket Profile as a Developer?
Real Python
Programmer Portfolio – Example and Walkthrough
Real Python
How to Get Your 1st Speaking Gig at a Tech Conference
Real Python
How to Build Your Public Speaking Skills as a Developer
Real Python
The Object-oriented Version of "Spaghetti Code" is "Lasagna Code" ?!
Real Python
Setting up Sublime Text for Python Developers – Lesson #1
Real Python
Cool New Features in Python 3.6
Real Python
"is" vs "==" in Python – What's the Difference? (And When to Use Each)
Real Python
Emulating switch/case Statements in Python with Dictionaries
Real Python
Python Function Argument Unpacking Tutorial (* and ** Operators)
Real Python
What Code Should I Put On My GitHub/GitLab/BitBucket Profile?
Real Python
A Crazy Python Dictionary Expression ?!
Real Python
String Conversion in Python: When to Use __repr__ vs __str__
Real Python
Method Types in Python OOP: @classmethod, @staticmethod, and Instance Methods
Real Python
Optional Arguments in Python With *args and **kwargs
Real Python
Python Context Managers and the "with" Statement (__enter__ & __exit__)
Real Python
Installing Python Packages with pip and virtualenv / venv
Real Python
"For Each" Loops in Python with enumerate() and range()
Real Python
Python Code Review: LibreOffice Automation and the Python Standard Library
Real Python
Managing Python Dependencies With Pip and Virtual Environments – Lesson #1
Real Python
Python Tutorial: List Comprehensions Step-By-Step
Real Python
Leveraging Python's Implicit "return None" Statements
Real Python
What's the meaning of underscores (_ & __) in Python variable names?
Real Python
Python Data Structures: Sets, Frozensets, and Multisets (Bags)
Real Python
Writing automated tests for Python command-line apps and scripts
Real Python
How to find great Python packages on PyPI, the Python Package Repository
Real Python
Immutable vs Mutable Objects in Python
Real Python
PyPI vs Warehouse, the Next-Generation Python Package Repository
Real Python
pep8.org — The Prettiest Way to View the PEP 8 Python Style Guide
Real Python
My Experience at PyCon 2017 in Portland
Real Python
Pylint Tutorial – How to Write Clean Python
Real Python
"Reverse a List in Python" Tutorial: Three Methods & How-to Demos
Real Python
Python Refactoring: "while True" Infinite Loops & The "input" Function
Real Python
More on: AI Pair Programming
View skill →Related AI Lessons
⚡
⚡
⚡
⚡
Most useless toy I’ve ever built. Love it.
Medium · AI
Reading Anthropic's "When AI Builds Itself" Changed How I Think About AI and Software Engineering
Dev.to · Hemapriya Kanagala
When AI Writes Most of My Code: What Happens to My Identity as a Software Engineer?
Medium · AI
When AI Writes Most of My Code: What Happens to My Identity as a Software Engineer?
Medium · Programming
🎓
Tutor Explanation
DeepCamp AI