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
€67.35
List Price:  €96.21
You save:  €28.86
£55.83
List Price:  £79.77
You save:  £23.93
CA$100.76
List Price:  CA$143.95
You save:  CA$43.19
A$112.23
List Price:  A$160.33
You save:  A$48.10
S$95.14
List Price:  S$135.93
You save:  S$40.78
HK$543.62
List Price:  HK$776.63
You save:  HK$233.01
CHF 63.04
List Price:  CHF 90.06
You save:  CHF 27.02
NOK kr797.48
List Price:  NOK kr1,139.30
You save:  NOK kr341.82
DKK kr502.49
List Price:  DKK kr717.87
You save:  DKK kr215.38
NZ$124.10
List Price:  NZ$177.29
You save:  NZ$53.19
د.إ257.07
List Price:  د.إ367.26
You save:  د.إ110.18
৳8,361.55
List Price:  ৳11,945.58
You save:  ৳3,584.03
₹5,962.79
List Price:  ₹8,518.63
You save:  ₹2,555.84
RM314.04
List Price:  RM448.65
You save:  RM134.61
₦108,335.42
List Price:  ₦154,771.52
You save:  ₦46,436.10
₨19,495.71
List Price:  ₨27,852.21
You save:  ₨8,356.49
฿2,390.81
List Price:  ฿3,415.60
You save:  ฿1,024.78
₺2,467.44
List Price:  ₺3,525.07
You save:  ₺1,057.62
B$434.14
List Price:  B$620.23
You save:  B$186.09
R1,296.68
List Price:  R1,852.48
You save:  R555.80
Лв131.68
List Price:  Лв188.12
You save:  Лв56.44
₩102,198.93
List Price:  ₩146,004.73
You save:  ₩43,805.79
₪256.56
List Price:  ₪366.53
You save:  ₪109.97
₱4,090.81
List Price:  ₱5,844.26
You save:  ₱1,753.45
¥10,994.99
List Price:  ¥15,707.80
You save:  ¥4,712.81
MX$1,408.98
List Price:  MX$2,012.91
You save:  MX$603.93
QR255.09
List Price:  QR364.43
You save:  QR109.34
P967.82
List Price:  P1,382.66
You save:  P414.84
KSh9,046.20
List Price:  KSh12,923.70
You save:  KSh3,877.50
E£3,562.49
List Price:  E£5,089.49
You save:  E£1,527
ብር8,907.19
List Price:  ብር12,725.10
You save:  ብር3,817.91
Kz63,830.88
List Price:  Kz91,190.88
You save:  Kz27,360
CLP$69,323.69
List Price:  CLP$99,038.09
You save:  CLP$29,714.40
CN¥510.80
List Price:  CN¥729.75
You save:  CN¥218.94
RD$4,245.36
List Price:  RD$6,065.06
You save:  RD$1,819.70
DA9,465.07
List Price:  DA13,522.10
You save:  DA4,057.03
FJ$162.39
List Price:  FJ$232
You save:  FJ$69.60
Q539.11
List Price:  Q770.19
You save:  Q231.08
GY$14,638.77
List Price:  GY$20,913.42
You save:  GY$6,274.65
ISK kr9,772.70
List Price:  ISK kr13,961.60
You save:  ISK kr4,188.90
DH703.98
List Price:  DH1,005.73
You save:  DH301.75
L1,291.33
List Price:  L1,844.84
You save:  L553.50
ден4,143.97
List Price:  ден5,920.21
You save:  ден1,776.24
MOP$559.97
List Price:  MOP$800
You save:  MOP$240.02
N$1,289.45
List Price:  N$1,842.15
You save:  N$552.70
C$2,574.80
List Price:  C$3,678.44
You save:  C$1,103.64
रु9,534.71
List Price:  रु13,621.60
You save:  रु4,086.89
S/260.99
List Price:  S/372.86
You save:  S/111.86
K283.85
List Price:  K405.52
You save:  K121.66
SAR262.91
List Price:  SAR375.60
You save:  SAR112.69
ZK1,936.45
List Price:  ZK2,766.47
You save:  ZK830.02
L335.12
List Price:  L478.77
You save:  L143.64
Kč1,694.03
List Price:  Kč2,420.15
You save:  Kč726.12
Ft27,771.44
List Price:  Ft39,675.18
You save:  Ft11,903.74
SEK kr774.38
List Price:  SEK kr1,106.30
You save:  SEK kr331.92
ARS$71,792.58
List Price:  ARS$102,565.23
You save:  ARS$30,772.64
Bs484.55
List Price:  Bs692.24
You save:  Bs207.69
COP$307,165.41
List Price:  COP$438,826.54
You save:  COP$131,661.12
₡35,530.54
List Price:  ₡50,760.09
You save:  ₡15,229.55
L1,777.33
List Price:  L2,539.15
You save:  L761.82
₲546,250
List Price:  ₲780,390.60
You save:  ₲234,140.59
$U3,115.91
List Price:  $U4,451.49
You save:  $U1,335.58
zł287.82
List Price:  zł411.19
You save:  zł123.37
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.