Hello and welcome to this video.
In this video I'm going to introduce you to what a python statement is what is a python statement a
statement in Python is an instruction to the computer to perform a specified action or task in Python.
A statement can be a single line or it can be multiple line.
Also you need the Python interpreter to translate the statement you write for the computer to understand
the Python interpreter is automatically installed when you install Python.
Let's take a look at how a single line statement can be written before you can write a statement.
You need to invoke or activate the Python interpreter so if you are on a Windows based computer you
can open up your command prompt.
If you are on a Mac you need to open up your terminal.
If you're on a Mac you need to type in Python 3.
Once you have your terminal open if you are on a Windows just type in Python and then just press enter
and that will give you the python shell.
So once a python shell is activated automatically the Python interpreter becomes invoked or active so
to write a simple single line statement.
Basically I can just do a simple metric those seven times seven and press enter.
That is a single line statement because it's on a single line.
If I press enter it gives me the answer.
I can also use a print statement just to print out a single line of text so hard just inside the opening
parentheses.
I will specify the text I want to print on the screen which is hello.
And then I'll close the parenthesis and if I press enter it will just print out the text Hello.
So these are couple of examples of a single line statement because they are statements that are written
on a single line of code.
Let's take a look at how we can write a very basic multi line statement to write a multi line statement
from the Python Shell.
You need two characters so you can use the slash character if you want to write multiple lines or you
can use parentheses to write multiple line statements.
Also if you're using a text editor or an integrated development environment tool that has a text editor
you can write thousands and thousands or even million lines of code inside a text editor.
But the illustration I'm going to show you is just going to be with the python shell.
So in my python shell if I want to write a multiple line statement for example I could say B is a 2
and then you use a slash and you press center and that allows you to add more lines so I can just say
17 and I do a slash again and a press Penta and I can just add one more I just see loss sixteen and
I press center.
Now if I refer to b it will give me the total tool of the addition of all the numbers.
So that's just the simple way you can implement multi line.
He can also use parentheses for example I can say C is equals 2 and I will have the code in parentheses
and I press enter.
This allows me to enter more line of code.
Okay so I just say plus press enter and I can just add another number say 20 press presenter and then
I can just close the parentheses and press enter.
Now if I type in C to give me 30 which is a total so that's one example.
Let's try and do an example that involves a string or a text.
So let me say Greetings.
What I can get this to do is to store some information so C equals to just a hello and they'll do a
slash to give me another line.
And in this line I don't know the text just say hi.
Wish you the best.
There'll be another line.
All right.
And then I can just press enter and that ends that.
Now if I call greetings it will just tell me what I have stored.
These are just some ways that you can implement the multi line and single line statement from the Python
Shell.
Thanks for watching and bye for now.