Project 02 - Quizme CLI - Building the CLI

Building Command Line Tools with Python, Julia and Nodejs Module 05 - Building CLI Tools - Projects
23 minutes
Share the link to this page
Copied
  Completed
You need to have access to the item to view this lesson.
One-time Fee
$69.99
List Price:  $99.99
You save:  $30
€64.94
List Price:  €92.78
You save:  €27.83
£55.57
List Price:  £79.40
You save:  £23.82
CA$95.27
List Price:  CA$136.11
You save:  CA$40.83
A$107.88
List Price:  A$154.13
You save:  A$46.24
S$94.55
List Price:  S$135.08
You save:  S$40.52
HK$547.57
List Price:  HK$782.28
You save:  HK$234.71
CHF 63.42
List Price:  CHF 90.61
You save:  CHF 27.18
NOK kr759.63
List Price:  NOK kr1,085.23
You save:  NOK kr325.60
DKK kr484.38
List Price:  DKK kr692.01
You save:  DKK kr207.62
NZ$117.46
List Price:  NZ$167.80
You save:  NZ$50.34
د.إ257.02
List Price:  د.إ367.19
You save:  د.إ110.16
৳7,682.93
List Price:  ৳10,976.08
You save:  ৳3,293.15
₹5,837.41
List Price:  ₹8,339.52
You save:  ₹2,502.10
RM331.26
List Price:  RM473.25
You save:  RM141.99
₦99,285.71
List Price:  ₦141,842.81
You save:  ₦42,557.10
₨19,466.20
List Price:  ₨27,810.04
You save:  ₨8,343.84
฿2,553.28
List Price:  ฿3,647.70
You save:  ฿1,094.41
₺2,262.39
List Price:  ₺3,232.12
You save:  ₺969.73
B$349.43
List Price:  B$499.21
You save:  B$149.77
R1,335.92
List Price:  R1,908.54
You save:  R572.62
Лв126.45
List Price:  Лв180.65
You save:  Лв54.20
₩94,634.34
List Price:  ₩135,197.71
You save:  ₩40,563.37
₪258.03
List Price:  ₪368.63
You save:  ₪110.60
₱3,943.57
List Price:  ₱5,633.91
You save:  ₱1,690.34
¥10,600.67
List Price:  ¥15,144.47
You save:  ¥4,543.79
MX$1,161.53
List Price:  MX$1,659.40
You save:  MX$497.87
QR255
List Price:  QR364.31
You save:  QR109.30
P959.59
List Price:  P1,370.91
You save:  P411.31
KSh9,203.68
List Price:  KSh13,148.68
You save:  KSh3,945
E£3,310.52
List Price:  E£4,729.52
You save:  E£1,419
ብር3,976.27
List Price:  ብር5,680.63
You save:  ብር1,704.36
Kz58,526.41
List Price:  Kz83,612.74
You save:  Kz25,086.33
CLP$68,581.80
List Price:  CLP$97,978.20
You save:  CLP$29,396.40
CN¥506.04
List Price:  CN¥722.95
You save:  CN¥216.90
RD$4,144.87
List Price:  RD$5,921.50
You save:  RD$1,776.62
DA9,443.17
List Price:  DA13,490.83
You save:  DA4,047.65
FJ$158.28
List Price:  FJ$226.12
You save:  FJ$67.84
Q545.87
List Price:  Q779.86
You save:  Q233.98
GY$14,645.83
List Price:  GY$20,923.51
You save:  GY$6,277.68
ISK kr9,762.20
List Price:  ISK kr13,946.60
You save:  ISK kr4,184.40
DH709.20
List Price:  DH1,013.19
You save:  DH303.99
L1,234.28
List Price:  L1,763.34
You save:  L529.05
ден3,991.30
List Price:  ден5,702.11
You save:  ден1,710.80
MOP$564.10
List Price:  MOP$805.89
You save:  MOP$241.79
N$1,325.35
List Price:  N$1,893.44
You save:  N$568.09
C$2,576.69
List Price:  C$3,681.15
You save:  C$1,104.45
रु9,334.54
List Price:  रु13,335.63
You save:  रु4,001.09
S/259.58
List Price:  S/370.84
You save:  S/111.26
K267.89
List Price:  K382.72
You save:  K114.82
SAR262.49
List Price:  SAR375
You save:  SAR112.51
ZK1,765.85
List Price:  ZK2,522.76
You save:  ZK756.90
L322.98
List Price:  L461.43
You save:  L138.44
Kč1,645.46
List Price:  Kč2,350.75
You save:  Kč705.29
Ft25,709.21
List Price:  Ft36,729.02
You save:  Ft11,019.81
SEK kr749.87
List Price:  SEK kr1,071.30
You save:  SEK kr321.42
ARS$60,034.20
List Price:  ARS$85,766.82
You save:  ARS$25,732.62
Bs483.70
List Price:  Bs691.04
You save:  Bs207.33
COP$271,296.95
List Price:  COP$387,583.68
You save:  COP$116,286.73
₡35,581.11
List Price:  ₡50,832.34
You save:  ₡15,251.22
L1,728.07
List Price:  L2,468.78
You save:  L740.71
₲516,441.87
List Price:  ₲737,805.73
You save:  ₲221,363.85
$U2,647.22
List Price:  $U3,781.90
You save:  $U1,134.68
zł280.50
List Price:  zł400.73
You save:  zł120.23
Already have an account? Log In

Transcript

All right, so welcome back again. So in this particular session, we try to build how our creates me CLR. Let's see how to work with the tool. First of all, we set up a virtual environment in which we'll be working right? So let's go to equity. So, to install our Petrova match within Pipi and V, just go with pip install PNP right, that is how to store this particular tool to enable us to work with our virtual environment.

So I'm going to just move on to PIP envy, then you just go into a store to review has to be stored in database stalling click be installing pi in Kora right there isn't really playing cards I've been playing quite hopeless to some if that increases by in Kora and then you can add any other stuff you want to do. So that is the basic idea behind it. So I've already installed it already. Now let's move on to the next step is actually going to activate our PIP v show Metallica To activate this particular virtual environment, right, so that's activated and we are already in a virtual environment. It so anytime you see this particular stuff, that means that we have arbitrary go with my LS, you can see that we have our PIP file here with all the stuff that you have installed on it right?

Unless physical create a folder, or move inside our model five, which is the model again, you're going to create a project to empty out, like I just create a project 02, right, you can use the CLR to help you do that. Or could Yes, could you tell me with this, then let's move inside our project to death nothing. So let's first of all, create a simple file, touch. Let's put a squeeze me.py right there. Let's open it from Sublime Text. If you're trying to see how to work with our simple tools, you're going to be pulled in Very simple.

Okay. So it is something very basic listed at the place. Alright, so now let's see how to build it. So I'm just going to create this file that you have already created, and to be structured. So the most important thing we need is we need, click right these are the main things, I really just want to create our main function which is going to take this particular quotation for Christmas. So anyway, that is going to be me CLR.

Right, something very simple, then just going to pass we're going to close it without if made right so the basic idea behind which we boarded it. And now let's work on creating our face groups when we click that group. And that is to put our article into these are you having to mean fascist? So the basic argument we have and it's going to be our crease me those pi or quiz me right this year like they love our stats and also have fun No one called me then info. These are the only two commands to be using right so our stuff in our input. So let's click on the stat to go to create a function for our stats and then go to create another function for our for this is going to be something like that, COI, oh squeeze something like that.

And then the next one's going to be for our cruising for very simple. So that is the first one. So I'm just going to go with our main command. As always, we're just going to place it under this particular made command and then we're going to create an ad on the same stuff. Let's go with click to start in. crease right there.

Very simple. I'm always bringing into a very interesting, so there's going to be four day that's come on, can you repeat the same thing for the infocomm on today is going to be a very busy call info to just give us info about the CLR. So before about chris chris Lee Thiele, right, crease me CLR that is Oh, then we just going to bring out something. So please, me sila, something very simple. That is what we need to believe to invoice click, we have created a simple click group, then you have created a sub command under this particular step. So this is going to be a command under the main group and another common enemy group.

So let's try to see so Drollet since you're running it in a virtual environment. You could just go in with PIP envy, run, then go with Python. Right there, then just run it as you wish quiz me I thought it'd be a good idea, but it gives you a no you just need only this command to enable you to be that is However you're writing because you're wicked within a virtual environment. So just go with this help. Like I see that it's working perfectly hope it doesn't give us any arrows to analyze it, and then keep us this command. So you see I have our info command here was info about this.

We also have our static query pivots who are squeezing out a four hour pivot. Very interesting. Now let's see how to add ambitions to this will be our click division option, because that's one of the best practices to have our vision then would supply division info, and then the bureau stat that we need is going to be program name which is going to be our crease me. Right That is the program name in good supply division that you want to give. So let me expand this one. So we can see the efficient vision.

Then I'll give the patient name but I wanted to be so diverse. He's going to be patient 0.01 right, that is what I need for. So if I come back and I run it again as previously, also going to see the same thing that we did with the evasion option. So we only had help here and our options, but now because you have added a patient option, also going to see division to see that our vision, then I can run this back again, especially. And then you can see the vision right the program name and innovation. Pivot to so we have our quiz me programming inefficient.

So we are done with a basic aspect. Now let's see how to add the logic to it. Right. So in additional logic, first of all going to do some interesting stuff, or contradict of my file. Then we're going to create a class for quiz, which we did to help us with that. And the class is going to take some 12 minutes, we'll take the prompt of our questions.

And then the questions itself, right, all the answers, questions and answers. That is test one and also going to have a data for all the questions that we have for the crease, they're still going to have a function to help us with that. Right? So is there a method between the list first of all quit our crease class, there's going to be our class that I just go with, please. If it did a discrete audition, I did this. Last one, I saw it.

Last one. That's cool, then I'll bring my self in, what we need is that we are going to be passing in our viewers information that we need. So I'll just go with my prompt. Right now just move on to the next one, which is going to be our other that you'd be surprised right decided two minutes that we need to have a face function to initialize it with ourself, but prompt to prompt as usual, then just go with ourself. But as I go to answer that is also that is order. We need to have created a sample class to be helping us with that to make it quite easy.

And quite easy. So the next thing that we need to be able to create our question list. So the question is is going to be for Moto G tech patients? Right? It's going to be a list felicita, the questions list, then it's going to go in this format. So we have a list that is that is going to have several questions.

So one of the ability Python is a dynamic programming language like this programming language, pivot, then that is the basic idea to that is going to be the question I'd be asking Allison accent right? Then from that you'll be supplying the various assets to the others to go with a space, then I'll go with eight for that particular answer, which is going to be true, then the next one's going to be another space. So we just go with this option, comma in a new line, in our fluids before my second option, which is going to be false. And us give two different life again to new life, right? To make it at least to leave a space for the next option. So that is something very busy, because we did a simple question here.

So these are under question, I just add those questions here. Right. So let me copy this question so that you use it. So I'll paste those questions is the same questions. So it's going to be the same stuff, right? So we have four different questions, which will get beverages interesting.

So I've gotten our questions that we'll be using. The next option is for us to create our classes right using the crease class that we had. So it's going to be in this particular format of let's take fishing. Then I'll just use a same stuff we did with a class option. The crease did not pass in my first list for this This one, I'm passing in my tech questions list, right? I'm picking up the face value from it.

And then the other two that it's going to prompt that to an hour to deface Python start from zero to definitely face value. The next one is going to be the other two, what is going to be the other? Based on our class, we have our prompt, which is coming from the stuff here, we have our answer The answer that the user is going to choose, right? So it's going to pay this question. And then our real answer here, right? So the other will be using this.

Right? Because Python is a dynamic programming, there's going to be different. The option for the face question. So there's going to be the first question. So the first class you have initialized, then we'll do the same thing for the last one. So I'll copy this one here.

Then repeat, repeat it for the next option, and I put the next option for an exception. So we have four different questions. So one, two, and then three, right? So this is going to be our one, then there's going to be two is going to be three. So this is going to make it quite easy to conduct right Change equations. So how many kilobytes make one kick which is industry and how many op languages this discussion is different, these are op, op stands for object oriented programming.

So each of them is not an op to D is Julia GLS not an op programming language is a functional or metal oriented programming language, then the next one is going to be for Python, which programming language was made intended. So, I'm just going to choose B JavaScript right. So, these are the main question people working on. Very interesting. So, we have been able to work on our questions list have created a simple class to help us map in our question and the answer. None the mistake is that you're going to be creating a function to help us run our test right so let's go does this run, crease.

In this run, Chris is going to take the Question with the sub questions, right? There's going to look to them questions and what's going to do is going to just fizzle we are going to have our school, what a great club any other than no just going to look through them to For Question, singular. In my questions, blew them out. I want you to just store everything that a person will just type inside is our answer, right? It's going to be our input, can you throw it in case you're working on Python 2.7 and we are in 2020. So 2.7 is no more pointed to have question right.

And then that prompt that question question. So, this question would prompt is coming from this particular class here that you have created right when you create a class we had a prompt you had an answer right. So we are trying to pick that particular stuff. So this is going to break out the question and then whatever the personality type is going to be stored inside this other Option, right? And then we are going to check our answer against our question. Just see what that score is a question.

Good answer. Right? So remember this question here is getting it's been taken from this class in the class has to have you have the prompt and then the answer. So that's what you're trying to compare here. Right? That is a basic idea, then is that the case, just add it to our, our scope is there.

So by default, everybody has zero, right? Then at the end, I'm just going to print it out. So click to echo. Let's use echo to add some color to it. To not just supply that particular color that I want to be I said the color is going to be let's see, you say you scored this particular value out of cleverly. Right to think I have four months.

Then I just apply it A particular policy we have on school that a person had, and then we're going to have the length of our questions. Right. The question that was passed, is referring to this particular question that was passed. He did right, you can have several questions. And so to integrate in different ways, that is what actually helps we have a sample budget. So to recap, we have our class that has our prompt producer point for the question, and then an answer.

We have our data that contains all our questions. And you have created simple class instances of equations. If we did a simple function to run our crease, right. Very interesting. We bring in this particular one piece, and that was that to eat a peasant choose a particular option, we won't be able to give it out. Professor list, come back in by default, just go with this option to increase and I'll pass in my take questions list.

The questions list that is all right. Supposed to be ready to take questions right away. just referring to this particular tech questions here. So let's try to see what is going to work I would say this one, come back to terminal, then just going to run it here. Apologies for the noise behind when you go is that unless you listen to it, so start, it seems to work without any arrow stem that our app is working very well, if it switches back, so Python is a dynamic programming language. He is true that how many kilograms to make one gigabyte, you see, then these are all p language except D for Julia, then which programming language was made in 10 days be said now you scored four out of four.

Right? Very, very interesting. So we have to get up quick in variable and let's add some beautification to it and add some more data to it. So I'm just going to come to this place and then add some color to is going to be our fg color is going to be white. And then our background color. It's going to be C. red or blue light.

It is that to me And it's working well. Now it's better we add different multiple questions. This is only just picking one particular quiz question. So in case I want to add different questions like maybe history like genomics, Ababa knowledge, let's see how to work with it. So I'll just come back to the top my phone, then we'll be using another package to do multiple selection, right. The newer the packet is going to be called pi incra.

To be from pi currencies in critical basket, but let's call it pi incre, which is supported in both Windows and Macintosh as well as minus two from bank or input prompt. And then we also input print rates, you can use this particular point to help us so print doesn't give up you can get it but you're not using it to just move straight away. That is the basic idea. Now let's come back to one piece here. That is creating an option here with a patient I select right can select the videos crease question is whether This Bible would take all history or politics. So how is it going to be, it's going to be in this particular format is going to go with our quiz type.

Then from here, I'll just supply a list that contains an array, right? So this is going to be a list that contains a dictionary. So the dictionary is going to go in this format, we have our type. So the type is that is going to take a list. There are several types that paragraph supports what is going to be a list type. Then the next one's going to be the name.

The name that you be using to display to the user is not to be questioned. Rights can be kept, they can be small, or can disclose this question type. So let's discuss learning so to be attached to whatever you type in there, then the next one is going to be our message that you want to shoot to the patient. So let's close that message. And then this is going to be question time. Question.

So the basic idea behind which is that FIFA perfect the face. So the next option is that we're going to be supplying the choices, right? Let's go down here and then come back to choices, there's going to be our choices, the choice is going to be what it's going to be, your data is going to select. So we have several choices is going to be a list. And this choices list is referring to that's why the type is list right? So the choices is going to be one of a list.

Do we have our tick? Then let's have another one to see. Bible, the list of choice again to see for history. And then finally, we can just keep something like this a sports right? So we have three different types. Right?

That is what we need. That's what we have done so far. Fitness agenda that are going to be passing inside our prompt. This is going to be our answer. For our crease type. It's going to be prompt To the prompt is referring to this particular prompt we imported here, right?

So we important that prompt from pintura is in a particular paragraph to prompt that particular question of just putting IP state. That is what we need, right. So if I come back here and I save it, and let's run it, see what you've done so far to come back here aren't static. So that now is going to give us all of these things that crease, such increase there is going to prompt these ones for us. So it's given us an arrow that's named pretty decent is not there. So can we even do this I can just take it off because we do not use the rest of these one off.

And let's see if it's still going to work. So come up here, once again. is going to work perfectly for us. Just like we did is what we were trying to do so pi in Cora allows us to be able to do this particular stuff, right allows you to create an option of selecting these ones, so I can just go with it. From here, select a particular type, and then it's going to work, right. And typically these illustrate again, just try it again.

And then we can just move on to the past class type for secondary school down, like that with the arrow right to select a particular type, what is the big idea? Okay, now let's move on to the next option. So be trying to add some different questions to it to be able to record it. So let's use a simple if condition to help us Mark true that's going to be something like this. So if my answer please type right. If and have to pass in this particular stuff.

So yeah, this is a dictionary. So what you are picking it up picking this particular question type here. Notice the message not the list on the choices but only the question type. So PCT, I see if my question type is the question type is referring to the specialist a few either Type stick, then give me only 10 questions, right? That can give me only take a look with a click with a cool video that doesn't stutter. Or you can just use any name, then I'm just going to run this particular function that we have, which is referring to this our common fashion.

So this is going to come here, right? It's going to run into previous one for server adaptations. This is going to be an operation. And this is going to be for another question. So we have this one for Bible and our policy history. We added them later history, right?

So we can just add these LCFF equations for conditions if it does the big idea behind it, right. So let's add our more questions to it. First, we have to select from day So, our our discussions here, we have added two questions we have tick and then we have by right very interesting. So now we just come up to display. So if the question type is tick, tick, tick tick question is either question type is Bible picked a viable questions, then you can just add as many as you wish. So that is the basic idea behind OSHA.

So let's see with an LS run down to fa, come back to my terminal. And then I can just run a written Hello, GUI stat you can have the option of selecting a particular type that you want to have tick, if I agree, take it nice, really take a good look at the B, C, D. that you got is called one right? peppers eligible something useful. Again, if I come back and I run it again, I can choose from the Bible option right? So this is going to be left for you to continue to add as many as you wish. Agree the Bible will read the Bible question see the SEC did we have a we have a we have seen Yeah.

Right. So he's got one other way. So that's the basic idea, you're going to build something useful, something very nice. So, to recap, the basic idea is that you're going to import all of these things. You call packages, you create a class for the crease, and it creates another questions list. Then, with the classes, you just create instance of the various questions to map our question and answer.

And then you do the same thing for as many as you wish. Then you just want to create a simple function to run our queries. And then finally, you just create your sample stuff with click. These are busy stuff we did. And we have learned previously as the basic idea behind which I've done so far. So thank you for watching and see the next session.

Stay blessed.

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.