 Okay, welcome to basic animation in Python 3. This is part 2. In part 2, we're going to go ahead and Change this so that we're using a function which will come in handy later. So this is fairly straightforward All we want to do is take this code here and make it into a function. Okay, so watch what I do here So I'm going to define the function. I'm going to call it player underscore animates Again, if you don't know what a function is, this might not be the right tutorial for you You need to go back and learn some of the basics before you can move on to these things So all I'm going to do is I'm just going to go ahead and copy this out of here And paste it And then I'll take this out and in the function. I'm going to call player animates Okay, so I'm going to call that function. Okay, so I'm going to hit function f5 in Genie. Other programs It's different. It might be command r depending on what kind of computer you're on etc So let's run it And again the animation is still working Okay, but what I want to show you here is this. So if I put in here a print statement. So print You know main loop. So we know the main loop is running So if I run this So notice how main loop is executing about every second Okay, because the animation is going every half a second So this is clearly not what we want to happen and the reason is that If this is using time dot sleep that stops the whole program Not just the not just the players animation stops the entire program So if you have a game and you've got a player you got enemies you got stuff flying around It's not going to work very well because of This reason because you're using time dot sleep to stop the entire program okay that said What I've done here is I've taken some functionality out of the main loop and I've put it into a function which is usually a very very good idea okay, so in next couple installments we're going to learn how to fix this and Do things so the animation keeps going without interrupting the flow of the rest of the program so that was a quick one I'm going to stop there