 Hey, what's going on guys? RudeLinL here bringing you back with another Python tutorial. Let's not waste any time Let's just hop right in the idle and get frackin. I'm gonna create a new program here called this file.python Get our get to start typing our our skeleton code Python not pytho. Okay, let's create a class. I'm just gonna use a base for my class name Define a constructor, pass in self Pass for now, and then we'll test if this is the current script. I screwed up my bracket All right, and then we'll do root Is equal to base All right now Today we're gonna be working with the power function are also known as the the POW Let's see. I'll show you. It's more of a mathematical thing. It'll raise the current raise what you pass to it to The current power that you've set it to so if we if we print out POW We can check out here Two to the power of four. How about that? We run it we get 16 because Two times two Two times two is equal four Two times two times two. It's equal to eight two times two Time to edit it. How many twos we have here times two is gonna equal 16 and then we have Because then we have four one two three four. That's how many twos we have here It's raised to the power of two. I'm sorry raise the power of four because this is raised to the power of Two because we have two twos This one is raised to the power of three This one is raised to the power of four. So that makes perfect sense. So let's try and recreate this all on our own We're gonna want to define a new function. Let's call this power We'll do self and we'll do base and then power Because we're obviously gonna need two arguments here So let's let's do what we need to do first of all We're gonna test whether the power is equal to zero because if it is remember you'd normally you would return Or at least you would get the answer of zero. So we're just gonna return one I'm sorry where you get the answer of one in all case all return zero. So Let's start going here now Let's do I in the range of one because we want to start counting at one and then all the way to the power We're gonna need to do here is set a product variable because this is where we're going to be able to keep track of our Multiplications so a product is going to equal base off the bat And we get in our our code our code block anyway for the for the for loop we can set up Product is going to equal the multiplied version of base And when we're done looping we can just return the product So every time we go through this iteration we're multiplying it by base again and again and again So let's try it if we had If we ran anyway, if we can print out what we get the product of the what at least what we get returned the information That we find we can get we can power We can change this to let's say two and two We run this we get four if we do two and three we get a we get eight Okay, so we did this to four we get sixteen just like we did that first time So here you guys can see how the power function works if you if you keep multiplying it by whatever you had originally It'll keep going and going and going if you do two to the power of one. It's just two We can change this to whatever we want. Let's do one of the power. I'll tend to the power of four There you go So there's your function people. I hope you enjoy it's it's pretty simple I mean once you get the basis of the idea that you just repeatedly multiply Whatever you're looping through and then you have your power function I hope you guys enjoyed this and I will see you guys in the next tutorial