00:01
Okay, so in order to generate random license plates, we are going to make use of some python libraries, specifically random and string.
00:17
And so it's actually possible to maybe not use at least one of these two, but they'll be helpful for the implementation i'm about to introduce.
00:27
So let's call def random license.
00:32
And so we're supposed to generate a license plate that has approximately equal odds of generating a license plate where there are three letters and three numbers, and then a different one that's four numbers followed by three letters.
00:51
So basically we can first see which one to generate it by, you know, basically doing a coin flip.
01:01
And so if you say, if you call random dot random, this will actually return a random number in the range zero to one.
01:12
So if we check whether this is greater than or less than 0 .5, it's basically a coin flip.
01:18
So we'll call this choice, maybe.
01:25
And then so if choice is, let's say, less than 0 .5, less than 0 .5, we'll generate an old plate.
01:39
And either way, we'll have a result string here that's just going to be empty, and we'll be appending the license plate accordingly.
01:47
So if choice is less than 0 .5, then we'll generate an old plate.
01:54
So this will be three letters and three numbers.
01:59
So for i in range three, we're going to say, we're basically going to want to generate letters followed by three numbers.
02:18
So we can actually take this random number and map it to integers from zero to 25.
02:25
So the 26 letters of the alphabet, and then map that to the actual characters using the string import library, which i'll show how to do.
02:35
So what we can do here is say, char char int val is going to be random dot random.
02:53
So int random, random times 25.
03:05
Yeah, actually wait.
03:10
Okay...