Hello and welcome to this video.
In this video I'll be showing you ways of interacting with Python the common ways of interacting with
python is via the python shell or console.
This is suitable if you are only writing a single line of code or a few lines of code.
You can also interact with Python via a python file a python file is basically a father has a dot P
Y extension.
So let's take a look at how we can access the python shell or console so we can access the python shell
via the command line interface which on a Mac is known as a terminal.
If you're on a Windows is called a command prompt.
You can also access Python Shell via the python.
I do the I do basically is what is known as an integrated development environment.
It comes pre-built with Python.
So when you install Python it also installs the python idle and the python I do has a python shell.
It also has its own text editor that you can use to write multiple lines of code to access the command
line interface on a Windows based computer.
You type in C M.D. inside the wrong command or search.
Once you've got that open you type in Python and that will give you access to the python shell if you
are on a Mac.
You need to do a search for the terminal.
Once you've got the terminal open you need to type in Python 3 and they'll give you access to the Python
3 shell.
The reason you type in Python 3 on a Mac is that Mac comes pre installed with Python 2 which is quite
old.
Once you have once you've got Python 3 installed to access it you need to type in Python 3.
If not gives you Python too.
If you just typed in Python so I am on Windows.
This is my command prompt so to access the python show I just type in Python and press enter.
That should give me access to the show you can see.
This means that the shell is waiting for instructions if you are on a Mac you need to type in Python
3 on the terminal.
So once you've got this flashing cursor it means the shell is waiting for instructions.
I can do a simple maths I can do seven times seven and press presenter and that will give me 49 so the
shell Python Shell is interactive.
If you want to print out text on the console you can use the print function Python comes pre-built with
a print function that allows you to enter the text you want to be displayed on the screen.
So those two a print from trying to do a print and then you have the parentheses inside the parentheses
is where you specify what you want to print.
You need to enclose that in quotes.
So I just say hello.
And you close the corpse and then you close the parentheses and you press enter and that will simply
display the text.
Hello and Python.
A text or group of text is known as a string and you will know where the computer can understand it.
If you put if you put quotes around them so you can't make the quotes you either you either surround
the text with two single quotes or two double quote but you can't mix it with a single and a double.
So it is worth noting that any time you want to print a text for the computer to know it's a text you
need to enclose it in quotes to exit the python shell you just typing exit and you enclose that in parentheses.
So you go to open in parentheses and close in parentheses and press enter and that will exit the python
shell.
Another way you can access the Python Shell is via the python.
I'd always come pre installed when you install Python.
Now this is a shortcut I have to the idol so I'm just going to click on it.
You can also search for it in your search bar and that should bring that up as well.
So I'm just going to click to open up the Idol and this is what the python ideal looks like and you
can see it opens up straight into the python shell.
So this is similar to the shell we had to look at earlier from the command line.
All right.
So those are a couple of ways you can access the python shell.