00:01
Hi, so in this question, we're dealing with the method palindrome word that will spit out a bullion, depending on whether or not the string passed in word is a palindrome or not.
00:12
So in this question, i just have two examples in the bottom, race car and person.
00:17
Race cart is a palindrome.
00:19
Person isn't.
00:20
If we look at race car, we can see that on either side of that middle letter, then all of the letters match each other.
00:30
We have 0 and 6, 1 in 5, 2, and 4.
00:33
So if we want to look at this string to find out if it's a palindrome, we don't need to iterate through the whole thing.
00:40
We just need to iterate through indexes, 1, and 2, comparing those to 4, 5, and 6.
00:47
We can just completely ignore that 3 because that could be anything and it would still be a palindrome.
00:54
So if we want to go through the string, we just need to go through half of the length of the string.
01:01
If you notice i have this little int right here.
01:06
The reason is because, if you can see here, we have the intcast right here.
01:15
The reason i do that is because the four loop in python is not going to accept a decimal value...