Welcome back.
I wanted to show you one other package.
Mind you, we have a video coming up on useful belt in packages and Python and we'll go over some of
my favorites.
But I want to show you one that's a little bit different than what we've seen, which is random.
And this one is called SIS four System.
Now import CIS.
If I do something like let's say print cis and I click Run.
I get a module six built in.
And so this is a really, really useful one that you're going to see a lot of.
Now with this, you can do something really interesting.
For example, SIS has something called a RGV.
And RGV gives you some interesting powers.
You see, up until this point, we've just kind of ran our code inside our IDE.
But what if we had a terminal here?
On our desktop.
And by the way, see over here that we have the V and V again, something that we'll cover.
So don't worry.
Now in here, I have a one dot pie file which is completely empty.
It doesn't do anything.
So let's just open that up.
I'm going to open it up with sublime text just because it'll be easy.
And in here I'll just say print.
So this is a Python file that lives on my desktop, so I'm going to save that.
And imagine here that I did Python three.
And then do one dot pi.
If I ran this, I get high from my terminal because this file's on desktop and I ran the Python interpreter
on this.
But what if I wanted to do something interesting?
What if I wanted to give parameters to this file?
Perhaps say that my name is Andre.
Well, with Cisco RGV, we can actually access those.
And I can give it as many parameters as I want.
So let's give it another one like this.
Let's go back to.
Wanda Pie once again, open up with Sublime.
And in here I'm going to import CIS six RGV and I can access these parameters.
Like this by an index.
So zero index will be Andre and one index will be negative.
So let's try that.
I'm going to say first equals cis rgv zero and then last will be cis dot rgv one.
So that now I can do an F string and say hi first.
Then.
Last.
Just like that.
So if I save this and now go back to here and ran my file like this.
All right, I get high one pi.
Andre and I made a little bit of a mistake here.
It looks like the first index is actually the file name, and then you get the optional names.
So it's an easy fix, right?
All we have to do is say one and two.
If I save that and click run, look at that.
I get.
Hi, Andre now.
Now using this knowledge that we've gathered so far.
I want you to use the built in module.
This SIS and the RGV to build a game.
I want a game where I can run it like this from the terminal or the command prompt, where it's going
to ask me for an input and say, Hey, guess a number between one and ten and it's going to let me keep
guessing until I get that number right.
So you might want to use, I don't know, the random module that we've learned.
So take a break, try to create that.
Now, this game beyond just asking for a user's input and giving you a guess.
1 to 10 can also be customized.
So that instead of just, let's say, running the file, I can also do something like Python three.
Run the file.
Let's say that this test file is going to be called random game dot py that we're going to write.
And in here I can give it options of let's say one and 100 and this program is going to take using system.
The number from start to end.
So this game is going to be really difficult because we're going to try and guess a number 1 to 100
or one to let's say two.
Which makes the game really simple.
So again, the goal is for you to write a program.
Call it random gain pi.
Ask a user to guess a number.
Let's say between one and ten.
Get that information, try to randomly generate a number 1 to 10.
The user is going to be asked when I get prompted.
Hey.
I want you to guess a number 1 to 10.
And from there, we're going to keep guessing, keep guessing, keep guessing until I get it right.
And hopefully at the end say you're a genius, or if I keep getting it wrong, well, it's going to
keep asking me until I get it right and maybe do a couple of validation as well to make sure that the
user actually enters what we want.
Good luck and I'll see you in the answer video.