Hello, everyone. Welcome back. Now let's talk about random module, we will use the random module to help us select the lucky color in our application when the module isn't built in functions, so it is not available unless we manually input it. So to use random, first we do input random. Random is the name of the module, then we can start using it. There's a lot of functions in the random module.
One of them we ever use is when done dot a nd I empty so we return a random integer in the range. So in here, we specify zero and 10. So it gives me 09 710 nine. So you Give you a random number between zero and 10 inclusively. So it's that easy. So let's go back to our lucky number application, we can use the random number as the position of a laser.
So let's first create a list. Hello is equals to read through blue, green. First zero is red colors, one is rule and cursor to a screen. So there's only three choices 01 or two. Then we can use random dot Rand in to select one of 10 false randomly Of course before we use random way to input lender and then when dum dum when in seal to seal Yeah, you Random battle between zero to two. Here's how we do it colors and it will give you the current names I'm still waiting for bro Yeah.
Okay. And actually, that's not the best way of doing it. We actually has a function when done dot choice and we can put a list in. So we put a list colors in and it will give you one of the random elements there. So this is how we use random in next lecture. We will Talk about for loop and range.
See you