So to start it, I'm creating the virtual environment directory using mkdir hello underscore env.
And then cd hello underscore env and python3 minus mvenv, that will create a directory
structure that is needed for the virtual environment. As you can see, the venv directory
and the three commands reveals all the things that are within.
So now the important thing is to source the virtual environment using source venv
slash bin slash activate. And now we can install the required module. So pip install
colorama. And oh, a new version is available. Well, we don't need a new version. Feel free
to use pip install minus minus upgrade pip to install the newer version of pip. But for now,
we're good. Then I'm going to freeze the current requirements that have been used
in requirements dot txt. And now it's time to write the script. Okay, so let's create the script
and call it myscript dot py. And in the script as a comment, I'm keeping the name myscript
dot py. And then I'm starting by importing date time. And from colorama,
which we just installed, import four. So here we have an import of two functions. One of them
is an internal one. The other one is coming from the module. Now I'm defining the variable now.
And now is set to date time dot date time dot now. Close it with opening and closing parentheses.
And then we can have the core of the script, which is using print four dot green
plus f current time colon now. And I'm going to make a small typo so that you can see what
is going on if you have typos. So let's try to run it using Python on myscript dot py.
And as you can see, Python is telling that something is not all right. It's telling us
that the not all right is on the closing double quote. So that's easy to fix. And obviously,
the closing double quote needs to be behind and not in front of the closing parentheses.
So here we run it again. And there we can see that in nice green color,
it prints the current date and time. And that concludes our simple lab exercise.