And let's do some exercises to practice on what you have seen in this section and also
combined with the last section. So we are going to
practice mostly on functions here, okay? And you
will have four different exercises. So the first
three exercises are actually the same as for the
last section, but this time you are going to use
functions, okay? So the functionalities that you
have previously implemented in the Python shell,
you are going to write code inside PyCharm. So what
you can do is you can create a new file for each
program. So I'm going to show you how to do that.
Okay, very quickly how you can create a new file
for each exercise so you can better organize your
code. So you are still in your project here. You
can right click new Python file, okay? And just
name your file. So for example, test, okay? This
is a Python file. I press enter and you have a new
test.py. So make sure you have the py extension
here. So now you have main.py, test.py. I'm just
going to write print hello from test, okay? Press
Ctrl+S or Command+S to save the file. And now what
you can do, so you can click on run here. And by
default it's going to run the main, okay? As you
can see here, it's going to run main.py. If you
want to run test.py, you can click on run with
dot, dot, dot. And you can choose the file test
here. And it's going to run test. So you can see
hello from test. And then you can choose here, you
can toggle between main and test. So if you click
on main, it's going to run the main file. Test is
going to run test file. So you can create different
files and you can toggle here. Make sure you add
them with the run dot, dot, dot here. All right.
And if you want to remove a file, simply right
click, delete. Are you sure? Okay. And so you can
add one file per exercise, okay? So the first
exercise you are going to ask for the name and
age of the user and print the info. This actually
is what we have done to explain the functions here.
So this is already done, but as an additional
practice, you can just start with a blank page
and rewrite that function, okay? As a first practice. And then, so ask the user for two
integer numbers, add them and print them with the
result. So you can create here a function to add
two numbers and return the value. And then you
can print the result. And for the third one,
create a list of four float numbers, compute the
average and print it. You can create a function
here that is going to compute the average of any
list of numbers. Okay? So you're going to call
this function and print the result. So those are
the three first exercises. And then the fourth one
is a new exercise. You are going to create a
function to convert from Celsius degrees to
Fahrenheit degrees. Okay? You have the formula
here. So you have Celsius degrees. You need to
multiply Celsius by 1.8 and add 32 to get Fahrenheit
degrees. Okay. So for each of those exercises,
one of the challenges also will be how you can
name the function, okay? Naming the function is
very important to give a meaningful name. And
then how you are going to organize the code
to make it work. All right. So now if you still
have some trouble understanding some concepts,
please go back to the previous lessons to watch
them again. And I will see you in the next video for the solution of the exercises.