 So let's take a look at an example where I want to convert a list of strings Into floats or rather just if it is a floating point number converted into a float so In this case, I've got a string separated by commas and I've split them Based on that comma and so now I have a list of Elements some of them happen to be strings some of them are integers and Some of them are floats Now specifically when we want to convert something like an integer we can do In that's great. And we can also do you know something like float Here but the issue is knowing which one of these commands to operate from now If I were to take this snippet of code and plug it in so let's just first build out that string Hello 3.1442 What was the last word test? and then Values at string that split on the comma values Okay, so again, we have our list of values that we want to process now again Each thing is currently a string and we can see that in action if I were to for I or for value in values print value and Type value type is just going to tell me what the data type of this particular Particular element is and we can see everything is still a string. That's perfectly fine But once again, we want to process these and we need to handle them in some way now the issue is that Strings have a few functions available to them for example value Dot is numeric Now is numeric is going to look at the contents of a string and it's going to say whether or not it's just numbers So you can see for 42 we get a true statement But you may notice that that 3.14 Still saying false and there is no is float Right. Oh look at that. There is no is float or Similar function for floating point numbers. So how could we handle this and specifically? How could we do it with exception handling? Well, that's a great consideration the way we can is let's first Build out is Float in this case and let me actually Clear out that there we are Well, the idea behind this is What we're going to do is we are going to just say screw it Let's try and convert it into a float if it can then awesome if it cannot then well, oh, that's Something like a string. So in that case first thing we would do is we open up with the try block Return float Value Now again, what this is going to attempt to do is whatever that value happens to be It's going to attempt to return it. However Let's accept because if it's not convertible then we can't convert it. It's it's Hello, it's test. It's not a floating point number So in that case what I'm going to do since we're asking specifically is it a float then we can use a Boolean return statement so return false so now we happen to have in our case a way to Understand and process whether or not a String is a floating point number. So let's try and convert this into The respective in and floats that it needs to be so for I in range Len Values so we're going through each one of the elements and now we're going to do a conditional statement The first one is let's just see first if it is numeric if it is just a numerical value if Val let's see Will will shorthand this so Val is values at I that's more for easier processing So if Val dot is numeric Because if that is a true statement again We don't have it here, but 42 this string 42 that would be a true statement. We want to convert it So values at I is going to equal in Val Yeah in Val we could also do values at I both of those are gonna work. It's More just I want to I'll keep it at values at I You know, but again the entire idea here is now. Okay, well, we've handled just Our our integers and just to see this in action for a second. Let's once again Print our values you can see that the 42 has converted, but once again 3.14 didn't convert into a float because we didn't build it But it's not being converted because it's not considering that a numeric value So let me boom that boom that Now we're going to add in a conditional statement L if L if and now instead of doing Val dot is float That still won't work right Val is float Just to show this still gonna crash right it's still not That's not how we built out our float we didn't modify strings the entire string object to have this is float function instead We could do is float Val and same kind of thing is gonna go on here. Oh well if it can You know, oh, it'll return the float now. Let's see. I will actually change this a little bit. So is float Okay Return true there we are so same kind of thing it just doing some different logic here because I want a true statement and in that case instead values at I instead of it being a Integer would be a float and so once again Just to load that up and I got to reset the is float in memory because again, I've just modified it So once again, I run it. Oh, look at that. No errors because again that got processed appropriately And so if I print this out What do you know I happen to have a floating points 3.14. So again, this is how you can use a try accept block for some easier processing when you're starting to run into things where, you know, you want something to happen or not