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're 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're 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 we have a new
test.py. So make sure you have the .py extension
here. So now you have main.py, test.py. Just going
to write print("Hello from test"), ok, press CTRL S
or Command S to save the file. And now what you
can do so you can click on the Run here, and by
default is going to run the main.py. Okay, as you can
see here, it's going to run main.py. If you want
to run test.py, you can click on a 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 is going to run, the main file, test is going
to run test file. So you can treat different files
and you can toggle here. Make sure you add them
with the Run... here. Alright, and if you
want to remove a file, simply right click Delete.
Are you sure? OK. 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 the 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're 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 challenge 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. Alright, 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.