Hello guys.
Welcome back to another class of our course about Python.
The complete introduction.
So until now we talked about all what other strings we talk about numbers.
And that today we are going to talk about another aspect of programming that is very important.
So and normally when you go let's say on the Web site or anywhere.
What's happening is that you interact with the Web site.
So let's say you are looking at products and then you are interested by certain products.
You click on the product and you go to pay the product.
So the Web site will ask you questions so let's say for example the Web site asks you for your name
your address your method of payment and everything.
You enter all those the Web site will send automatically a receipt to you and will send you a thank
you message and we'll send to the person who owns the Web site a message that someone bought their product.
So how all this works behind the scene.
Well there is a way to reproduce all this on Python and the most basic way to do it will be by using
the input function so the input function will simply allow another user to interact with our let's say
app.
So this way you ask that so you you will be able to ask basically in the most basic basic way you'll
be able to ask questions to your user.
So let's look what all this looks like.
So how do you write an input function.
It's very simple.
So it's gonna be written like this.
So it's just input and you write down the text that well you write down what you want to ask from the
person let's say for example we want to ask from the person what is their age.
So what is your age.
So it looks something like this.
And if you want to print it you simply write down print
and you print your function.
All right.
So as you can see here we ask the person their age.
The program is still running.
So right now we'll answer let's say the age of the person is 20 years old and you click on enter that's
it.
So the program is done to process finished.
The answer is 20.
So in this case with it's something that is very very simple we print it up directly the input but let's
say we want to make it a bit.
Well not more complicated a bit more cool and instead of just printing what is your age.
Just printing this and then printing the answer.
We want to print and we want to put our input into a variable.
So let's say in this case with we will put it in the variable age
so we'll say age equal
and in this case will be input.
What is your age.
All right so right now we have this.
So in this case it's age.
So our variable age is equal to the input.
What is your age.
All right.
So what exactly do we want to print.
So right now we have let's say we want to print our age.
So our variable age and we run the up.
So the exact same thing will appear here.
Let's say Write down 20.
And that's at the up ends like this.
Let's say I want to make something let's say I want to make it a bit more cooler so we can write down
my age is
plus our variable age and we can just run the up.
What is your age.
Write down 20 as you can see my age is 20.
This is just you.
And as you can see my age is 20.
So basically we just asked a question to the person that is let's say in front of us right now let's
say you want to do it a bit more cool.
So just practice it.
Let's create let's say I don't know ask a person what this person wants to eat.
So in this case will well eat drink and let's say ask that person their name where they want to eat
and their age.
All right.
So first of all we need to define our variables.
So the first variable will be name.
So ask the person their name.
So input and the person will write down what is your name
the age of the person.
So the second variable that we are going to look at will be the age of the person.
So once again input and then write down what is your age.
Third input.
So what.
So in this case food
in this case will ask the person once again what an input.
So what do you want to eat and finally our last question will be what do you want to drink.
So what do you
let's just call it a drink drink.
What do you want
to drink.
Right so you get the point on C and it's very simple
good.
So right now what exactly we want our app to print us because right now we have our variables which
are right here.
Name each food drink you want.
We want to print a let's say not a statement but a basic sentence which will say Hello my name is
just below so here we will have a string.
So hello my name
is and the first thing I want to do is a plus and I want to add the variable name and we continue our
sentence
by yam this time we'll add the variable H.
We'll continue our sentence
I want to eat here we'll continue our sentence so we add food our third variable
and I want to drink
and we add our last variable which will be drink good.
So right now we have our basic set up which will simply print what the person wants to eat and to drink.
Well what's the name of the person the age of the person what the person wants to eat and to drink.
So very important simply add those.
Well if you want to look good not forget to add space.
Because if not you'll see everything will be too close.
Great.
So after that simply click on plain.
So first question What is your name.
So in this case let's say my name is.
I don't know Max what is your age.
I'm 35.
What do you want to eat pizza.
And finally what do you want to drink.
Caller Hello my name is Max.
I am thirty five.
I want to eat pizza.
I want to drink cola.
So as you can see here we created a small app that will generate the name of the person the age of the
person what the person wants to eat and what the person wants to drink.
All this with the simply the function.
All this simple with the input function.
So once again as I explained before this allow us to talk with the well this allow us to talk with the
person who is behind the apps or the person the user the person who will use the app.
So once again what I just saw you slow up is the basic of the basic in Python and what you can do with
the input function you'll see the more we're going to advance in this course the more you will do cool
stuff.
And as I said this is just the basic of the basic you'll see with the input function you can do a lot
of very interesting things.
And when you put everything one way to put everything that you guys will learn you'll see you'll be
able to do a lot of very very cool stuff.
That's it for this class guys.
And I hope.
Well right now I suggest you to practice what you just saw and see all in our next class.