Right, so welcome back again. So in this particular session, we try to see how to build the randomness CLR that we built right, as we demoed in a previous session. So let's see how to build it. So I'm just going to quit my Moodle five. Anytime I would if I'm going to create a simple file called randomness does the name of a CLR that you would call just random, anonymous white.pi. That is the basic idea.
So let's see how to build it. So the first thing is that first of all, we'll be using shebang to enable us to do that can go without it, it's still going to work. But let's add it to our CI is going to be our going to be a shebang. Right. She can't do that. Because your windows no see the effect but it's still going to work for any Unix based system.
So Thomas Kali, if the files executed to be in Python to run right. Let's see this one perfectly. Now the next thing that we need to be able to import our properties to put a pass then also need to import And then we'll be important. Some other stuff which will be important will be color for coloration to be the same color. So from color, input, color, and then see print colors. These are the basic stuff if you need it for up.
So let's see how to put it to put up a way to structure up memory and see how it's going to be used. Right? So the simple usage is going to be like this. So we're going to be our randomness. Random lists, then we're going to give a common comment that can go into movies or can be books can be blocks. Read the purpose of that.
So the purpose of this app is to randomly recommend movies blogs books, sell as many as you wish, right. So that is the basic idea. So that is one of the UCC. The net proceeds are going to be also added a limit Today is going to be limited if I set the limit to five. So that is how we wanted the user to know. So what we are going to be doing is creating an option, right an option argument called commit.
And in Musil I the best person that most of the options and I commit, I usually or commands I usually do in ways or vapes, right CAN MAKE IT resources, but it's better you make it as a way, that is a good idea. So, comment this one out the list. So I'm going to create a face mean fashion to be our main function in which give it auto strength as usual, to be simple commendation CLA, right, perfect. The list goes it without it needs to be made. Perfect. First, although we need to list both the physical path to be a path which is going to go with the normal octopus admit They're not passing the description up which is going to be through a simple recommendation CLR rights or randomization sealer so let's What does random run don't miss what are we need to be our description Now let's add our program to the program name to it by going with this option of police for the night behind broke then we supply the program nifty so it's going to be random Miss right under Miss if it's let's make a small letter that is a program name.
That is what we need so far to add a p look. Let's quit this. A blog is going to be something we will be calling the task let's say a commendation by randomization satellite that right Something interesting, something funny here, the next thing we need to do is to click on our vision. And then we're gonna push now, I think that is the basic idea. So that is what you'll be using for our app. So let's add a vision to it, which is going to be a pastor with an agreement as we laid out, now passing my long format in our chat format to be patient, then partial to modesty, then I cannot pass in the patient name, right.
So it's going to be as efficient then passing the program. So repeating the normal format of this in passing the program to program so this must be inside a string format. Prague is broke. Then I'll pass in 0.01 2.21. So we are done with it right? Then we can just set the action to be vicious.
Then continue with the help. So let's put this on as a help. Question. That is what are we need, right? So we have to do something very simple something. So now let's start all argument namespaces was going to be our namespace.
So beginning with our x, pass, pass x. Now we can actually print it out. Pretty nice to see what you're done with something very busy. Something very simple. Admit it. So we just created our parser.
If we did our vision, then you have created our namespace to store everything that you wanted to let's come back here. Inside our terminal is going to Python three then the name of the Apollo Mr. says hello We have to see everything we can to help our randomization description, then our computer is working in an efficient vertical division and get the program name or domain 0.01. Very interesting. So that is how to work with it right through IBM to build something very simple. Let's add the logic to it to be adding recommendation to so how do we add the logic to the simplest we that list first of all good r plus r dot add argument, an argument you agree with this comment? Then I'll just pass in the short format R, then I'll give it the Help is going to be by the miracle man.
So randomly run don't delete the comment. Right, then I'll give you the choice of what I would recommend to what I would recommend it I would recommend books. I want to recommend movies I want to recommend Lexie Sopranos right What about you quite so let's do the phase two for now. So now everything is splitted. So let's check on that because we do think he's passing they recommend a comment. Right let's see what is it was something I recommend is passing books recommend books right if we dominate our lives because he is able to store whatever is being passed inside our argument.
Very interesting. Now let's see how to add the logic to a disclaimer of this or come back to an ATM. No, I just quit Python. We opened Python to record it. Very interesting. Now for me, I just import random with random to help us to randomly select from a list or create a list called a list is going to pick in some stuff so we have something like this he sells right they will have another one that list Sinbad in passing, and another interesting like basin of interest, person of interest.
So these three books right, we want to randomly select from listening. So with random commute to randomly select a single choice or multiple choice. So let's see how that would be random, but choice is a single choice from the from the list. This right is giving us a Star Wars variant again, when can we stop based on interest another random choice for anything is going to give me I try to as much as everyone is always going to pick randomly one choice from it. Right pivot tool, that is for picking a single choice. So in case you want to pick multiple choices, not just one guy just come back to the same thing.
Then go with random choices, not your choice but choices and I can go straight away, then this would give us enough of a list. Please give us and if most of us drink by this giving us a format or a History taught, I can run it again, there's also going to give us something different. But the keys are to select to throw one, then I just come back to this place. This supply the key, right, the key is going to be that the number or the limit you want. Let's give it us two by two. Now I'm going to select two from the list of symbols and symbols, burnt again, I'm personally interested in Star Wars right at the basic ID.
So that's what we're trying to use to build our symbol sealer. So let's come back to this place in the list, click on our data. So we have our paths random color, there, let's add our data to it. So this is going to be our data. So I'm just going to create a book list. So let's go to our books list.
And us adding some books to the booth we're adding a simple boost like I see a bio the most popular books now going off script it very nice book, then our vision is clear enough is not enough, and a wonderful book. So these are these books right silverwood. And I can go with it in a very nice, interesting books, right? That is pretty useless. So in case I want to randomly select from this, I can work on it. So let's add that logic to it.
I'll come back to my x here. And I would say that if my asked to recommend is to go to books, then I want you to randomly pick from this our books. So as we learned from here, we have the choice to continue the same option here. So it's going to be this result going to be our random choices. Now passing my books list, like this printed out, so let's print our results. So let's save it and let's run it for this one interesting, see what you have done.
Come back to this please close this. So now Jessica with the help. Everything is working as expected, I think it's I want to recommend a book. Let's go with Tasha recommend. Now passing the book super good books, as well to print it out to unscripted. Right, give us only one book.
I run it again. Today, so tennis very, very interesting to me that our app is working very well. So let's give it a limit to be adding a limit to it. So yes, come back to this place, and go with the passer. But add a comment. And I'll go with the long format of the limit.
And then the short format of the limits right. Now Good Hope. So there's going to be set limits set. Then that is all right. So I can give it a default value. So let's do that for value.
Let's see. Two, right, so please give us two different stuff in our past this limit here as my choice is going to be key going to be our hogs got to limit, right? But this is good, but this won't be seen as a strength we have to convert this one into. So you can do it here and then run it or you can set it up. So let's try this one first. Come back again, is gonna be just us limit, say two, three, or two, then I set it off, we can clean up internet, right?
The limit is set us two. By default, if I don't supply any limits, it's going to print two for the Bible and Bible. So let's change it from here. To change from us, we just come back to this place, specify the type Is it right? For integer, don't you just get it automatically committed to it at the top of our capital. That is the basic idea that you have that so let's add some goose Some other stuff to mess with is going to be for our wish list to add movies to it, and then disable them.
So let's import our data. So I'll just have our data file here, which is all these particular. So the idea is to have all this stuff in a desert.py file. But the important is books list, just several books. And then Movies List just several movies into our app. So you can just copy this one here embedded here, or you can just import it to let's import it to input our data and ensure that our data.py file which will be part of the resources is the same location as a random is right.
From here, I can now go off with this option. Now go with data. That's booster. So we're going to look inside this data file and pick that particular list for us. Right so it gives this movie list going to pick movie list for us. So that is the basic idea.
So no more need of this. I come back to this place, too. Help movies, books. So let's add this option to TV. If that command is to go to movies, then recommended to result is go to random choice to random choices and passing my movies list by then the key is going to be x dot limit. The list printed out very interesting.
So let's run it again. And now let's come back and see what else we do. So this is phone books. So I ran it again. given us an error, the reason is given as an error is that these books list has not been imported right to the point is you have to bring the data to a piece of data. But book this so this data is referring to this data file, and then it's going to look at our data file and pick a particular list for us.
Alright, let's see. Let's run it again. So cat is running. Now if I run it is going to work perfectly for us first movie Animal Farm, George Orwell. And then this is to just make it delimit jealousy, then, as predicted by this is not nice, right? This is not user friendly, right?
It's not user friendly. So we are going to look through it to make it user friendly. It also got some beautification to it. So let's add those beautification to it and it will come to the top of my thought here. And as it decreases, then there's good recommended. Recommended right, then are passing the particular stuff I'm recommending to the user, just in that format, now passing day, x dot x dot recommended if it's going to give us this particular heading right for it, so I'll copy this one.
Paste it for Our movies CBT play a comeback. And it seems that we did. Now we have our recommended books here. Very nice, right? So we can actually add a color to it before adding color to it. Let's beautify this.
So how do we just to be looping through it to be really simple, this is normal print. So let's go with maybe this one results, and then look through it, there's going to be four result singular, in my results, plural, then we're going to print that result, right? Same thing I've done here, rupees 410, this option here. So let's leave it to it and give us a nice result. Or let's run it again. So it is a good one if I run anyone, notice it's a bit right it's given us in a format of not just a list like this, but looping through them.
This is quite nicer, so we can actually add a color to it. Now this one is separated from this one. So let's have some colors to it. So to add some color between 10 color, which everybody from here, then we didn't call it OC print. So the basic syntax for adding colors using theme color, that's just going to go with the color right at the center, then the test, then the foreground, the background, and then you can just keep the attributes and attributes must always be the least it is a big formula for working with color, and color. So let's use our same thing to beautify this one.
So we can just go with a colored so this is going to be artists that are going to go on with this one. So there's gonna be a test, good foreground of lifting blue. And then the background is going to be on white on white. This one it's come back here. Let's see two You've given us an interesting fact, right? We have to make sure that is actually working, we'll call it so let's be this must be here.
Right? It's true. This is a footprint here. So let's try it again. While also not just giving us we committed by this color is okay, but it's not the best. So let's invert it right we'll be making it blue on white.
Instead of white on blue, to be white. Then on blue, Sky see with unless, again, this is better, right? This is quite nice. So everything is working as expected. So it is quite nice, but you can make it better by simplifying the color. In a unit c print.
We'll go with the C print, the colored print, the logistics of that going to give us the same result as above. If we tried to do this with a C print, so, you can either use a colored policy prints or just copy this one here and then just pass it on top of this place. So, that is the basic idea. So we have survived up by two years cannot do cannot movies can had blogs, books, several of them today's programming books and so forth. If we can just copy them, then add it to your choices, get it which should so that's the basic idea. So this is one at elsif is duplicated, add an add on to it.
So this is meant to be an out so let's come back here. And for B you can just add an R so this would add something different like the size or the size, or music or any as you wish. You could add the data size here as well. Right, to make sure that this Movies List change to our data size. Got to make sure that this data size is found within our stuff. Copy it here, good data size.
So list two, we have data size blocks, right so let's use the design blocks to help us with that. I'll copy this one here, then on to this data size, that is going to be data size blocks, right to be looking through it and giving us our result. So let's print it here. Come back here. I thought of books let's go with data size. While I thought on official Google data size blog, data size, look very interesting and very simple.
So that is something very basic that you have that Suzanne just created else. Fashion wellness club, In just 30% of print, get a better manual supply. Like what is a peasant I know give us it's not fun Venus automatically recommend something for the person to just copy the same thing. I think you know solidity we use books, right? It is the basic idea behind it. So in a nutshell, what you need is that he is going to import our packages that he bought 10 colored secrets from them color, then just get our meat fight a little bit of our pasta, which have a vision argument about ocean argument.
Then with our choices, you can add as many as you wish. Then you can also add limit value within random to randomly choose from our list and with a limit and then pick them out. Right That's the basic idea behind ocean busha. Thank you for watching this tutorial. See you in the next session. Stay blessed