 Hello, this is Christian. We're going to part two of the credit card number check exercise. Now in this part of the video, I'm going to do the same as we did before. I mean, the calculation will be very similar as the first video, but I'll be using the for loop instead. So again, just a recap of what this application is about. You're going to check the validity of a credit card number. We'll be using just eight digits number here. You want to check these numbers by, you know, doing a simple calculation as you state in this document here. And once we get the sum at the bottom here, we get two sums. We want to check the last digit to see that digit is a zero. If it's so, then that is a valid number. Otherwise, it's an invalid number. Okay. And then here are some numbers you can try as well. Okay, if you missed the explanation, please watch the first video. I explained it in detail. So let's go to the spider IDE. This is the previous exercise. Again, just to make sure that it works, I can run this again just to test that and have some simple numbers up here. This is the one in the document. If you run it in here, if it's a valid number, you see that it's valid. If it's invalid set, change that to a different number, then that should be invalid. Oops, I forgot to run it. You have to run it one more time. So if I change to seven, and that is invalid because the total you can see is 52, and the last digit is not a zero. All right, so now I'm going to copy just this part here. And I'm going to create a new file in here. We'll call it maybe cc2.py. I'll just paste it right up here. Okay, so we're going to do a full loop. And the first one is for the sum one. This is also very simple. And all you have to do is you do it for a range. And the range is going to be the index, I'll call the index, and the range between, you know, from the far right. We want to start from the far right. So let me collapse this, you can see. Okay, so you want to start from the far right digit. You're going back, you know, step of two, going backwards. Okay, so that means my range, my starting range, is going from the length of the temp, right, from the far right, and minus one. Okay, because I'm not including, because if I don't include, you know, the, if I say the length of eight is really eight, but the index position is really seven, right? Up to seven only. So you want to minus one to get the last digit. And then you would do a step of a two, but going down from there all the way down to zero. And then you're going to do a minus two for this step. Okay, so that should do that. It should grab every other digit from the far right going backwards until you reach zero. Okay, just to be safe, you can also do, maybe do a minus one here just in case it goes to zero, right? So now we're going to do just something very simple. Some one is plus equal to the temp of this index, right? You grab the last digit, which is zero or five or whatever it is, and temp of index. And then you want to convert to an integer. So we do the conversion here. And then that's it for them, right? It's very simple. As you can see, there's no updating your index because it's automatic. It's automatic does it right here for you. So that's it for that part. And then also want to put here some one zero, some two is also zero. So we got that one. And the second part is the sum two. So here, and will be kind of similar index and a range from the length of temp. Okay, this time I'm going to do a minus two because I'm starting from the second digit, right? So minus two gives you that. And then again down to a minus one, because we want to include a zero, right? Because this is inclusive, exclusive. And then the step would be also minus two going in a negative direction. So we'll back to where we were before you want to check if the total if the number is as a two digit or not, right? Remember, we're going to do a summation of this one. I'm going to multiply this by two, and then add their numbers, right? So you will get the number in is equal to temp of index. And we're going to times two. But before you can do that, you want to convert it to a number. So it'll be int of that times two. You'll get a sum. Then you want to check if n is indeed greater than equal to 10. If so, then it's a two digit number, right? And then you can do a conversion here again. So n is equal to the string of n. And then now you can do the sum of two plus equal the int of, right? n of zero plus the int of n of one. And that's your sum two. If the digit is a single digit, and the total here is a single digit, then n is already that single digit. We don't have to do any extraction. Then we just basically add that to the sum two of n equals n. And that is pretty much it for this calculation, right? Very similar. And then down here, we can check for the check digit. Again, we'll do a total. We'll put some lines in here. A total is sum one plus sum two. And we can convert that right away to a string. So we'll get the sum. And then we're going to get the valid value is the total of, right? The length of total minus one. Again, just make sure your code works for every case. A single digit, you know, five, three digits, right? Always works. And then finally, we can say if the valid value is a zero. Remember, this is a string. This will fail, probably fail. So you want to convert this to a integer again. If you don't convert to integer, make sure you put a quote around the zero, okay? So since I already did that, it's going to be integer. If so, then say valid. Otherwise, it's invalid. Alright, so that is the full loop. And again, you can compare this to the while loop. Okay, it looks very similar. The processor very similar without this part. But this is indeed the full loops. So let's give it a try and see if it works. So on the right side, I'm going to enter this first set of numbers in here. And so here we go. It's valid because the sum is indeed 50. Try this one here. And we also get that as well. Okay. So that is working beautifully. And of course, I did not put a loop here. But you probably want to put a loop and you keep enter number. And then if you enter a different number, then just say quit, right? Alright, so in the next video, I'm going to do the same program. I'll be using different approach without any conversion. So no conversion like I did here. Okay, all are going to be just integer. And we'll do the whole process using two very special operators, the modulus operator and the full flow division operator. Okay, I'll see you in the next video.