[Intro Music]
Alright guys, I hope that you were
able to create this tiny Python
application yourself. And now let
me do that together with you. I
have actually created this file
before, but I have removed it
just, and now let me recreate it
from scratch. Let me go to Visual
Studio Code, and here along with
hello-world.py file in the
same 'python' folder, I'll create a
new file, 'calendar-app.py'. Let
me close this 'hello-world' file. And
here, let me click on 'python' folder,
and create a new file called
'calendar-app.py'. Great, let's
first import 'calendar' module. It
is built into the python module.
Let me type 'import calendar'. And
next let me print text to the
terminal, and the text will be
'Welcome to the calendar
application!'. Let me copy it
from here to save time, and let me
use here single quotes like this.
And afterwards, we need to get the
input from the user, namely year
number and month number. For that
we could use the input command
'input', and here will be, let me
switch to terminal, and copy this
text from here. So, 'Please enter any
year:'. Afterwards, in order to reuse
number that was entered by user, we
need to assign it to some variable.
And first let's parse it using
'int' like so. And let's create a new
variable, let's say 'year', and assign
this result to that variable. In the
same way, we need to get the month
number and assign it also to the
variable. Let's use 'month' variable,
and here will be 'int', and here will
be 'input', and let's paste here,
input I will copy it from here,
like so, paste here. And now we
have two variables that will hold
the year number and month number.
And afterwards using this year and
month, we need to call specific
method of the calendar and print
the result of that method to the
terminal in order to see this month
view. Let's do that. Let's use the
print command, 'print', and here
inside let's call a method called
'month' of the 'calendar'. 'calendar.
month', and here it gets two
parameters 'year' and 'month'.
Actually, we have reused here those
two variables. That's actually it, and
here after this line, we will
get this output. And finally, let's
print this line to the terminal.
Let me copy it from here and use
one more 'print', and here will be
'Have a nice day!'. That's actually
all for this tiny application.
Let's save the file, go to
terminal, and let me clear it, and
run this application with the same
command as I have used in the
challenge task. Again, we run
specific container in interactive
mode with '-i' and '-t'
options. Next comes volume mapping.
We map local folder, 'python'
folder with two files into 'app'
folder inside of the container, and
also we specify that we want to use
that folder as working directory.
If you do so you don't need to
append here prefix 'app' before
specifying the file name. And next
we use python image and override
default command using this part.
And we simply run 'calendar-
app.py' file using Python3
interpreter. Let's press Enter.
'Welcome to the Calendar application!
Please enter any year:', let's say
3000. 'Please enter any month number:',
12, December; and I get this result
in the terminal. That's how you're
able to create this small
application using Python. I hope
that you enjoyed it. And actually
that's all for this lecture. And
that's all for Python part. If you
want to create more complicated
applications in Python, you could
do that on your own. But the main
goal of those several lectures was
to show you how you're able to
launch Python applications using
python containers. I will see you
next, and next we will try to create
Node.js application. See you next. Bye-Bye.
[no audio]