1 00:00:00,480 --> 00:00:03,510 Hello and welcome to this video. 2 00:00:03,570 --> 00:00:13,030 In this video I'll be showing you ways of interacting with Python the common ways of interacting with 3 00:00:13,030 --> 00:00:18,460 python is via the python shell or console. 4 00:00:18,490 --> 00:00:26,950 This is suitable if you are only writing a single line of code or a few lines of code. 5 00:00:26,950 --> 00:00:36,670 You can also interact with Python via a python file a python file is basically a father has a dot P 6 00:00:36,670 --> 00:00:38,490 Y extension. 7 00:00:38,560 --> 00:00:48,490 So let's take a look at how we can access the python shell or console so we can access the python shell 8 00:00:48,520 --> 00:00:56,300 via the command line interface which on a Mac is known as a terminal. 9 00:00:56,320 --> 00:01:00,240 If you're on a Windows is called a command prompt. 10 00:01:00,310 --> 00:01:06,190 You can also access Python Shell via the python. 11 00:01:06,190 --> 00:01:15,070 I do the I do basically is what is known as an integrated development environment. 12 00:01:15,250 --> 00:01:18,330 It comes pre-built with Python. 13 00:01:18,340 --> 00:01:27,580 So when you install Python it also installs the python idle and the python I do has a python shell. 14 00:01:27,640 --> 00:01:37,570 It also has its own text editor that you can use to write multiple lines of code to access the command 15 00:01:37,570 --> 00:01:41,300 line interface on a Windows based computer. 16 00:01:41,530 --> 00:01:47,820 You type in C M.D. inside the wrong command or search. 17 00:01:47,830 --> 00:01:54,160 Once you've got that open you type in Python and that will give you access to the python shell if you 18 00:01:54,160 --> 00:01:55,720 are on a Mac. 19 00:01:55,720 --> 00:01:58,050 You need to do a search for the terminal. 20 00:01:58,300 --> 00:02:05,950 Once you've got the terminal open you need to type in Python 3 and they'll give you access to the Python 21 00:02:06,160 --> 00:02:07,890 3 shell. 22 00:02:07,900 --> 00:02:14,950 The reason you type in Python 3 on a Mac is that Mac comes pre installed with Python 2 which is quite 23 00:02:15,040 --> 00:02:16,180 old. 24 00:02:16,300 --> 00:02:22,050 Once you have once you've got Python 3 installed to access it you need to type in Python 3. 25 00:02:22,150 --> 00:02:24,110 If not gives you Python too. 26 00:02:24,120 --> 00:02:28,500 If you just typed in Python so I am on Windows. 27 00:02:28,570 --> 00:02:37,520 This is my command prompt so to access the python show I just type in Python and press enter. 28 00:02:37,660 --> 00:02:40,060 That should give me access to the show you can see. 29 00:02:40,060 --> 00:02:47,680 This means that the shell is waiting for instructions if you are on a Mac you need to type in Python 30 00:02:47,680 --> 00:02:49,600 3 on the terminal. 31 00:02:49,900 --> 00:02:55,270 So once you've got this flashing cursor it means the shell is waiting for instructions. 32 00:02:55,280 --> 00:03:04,210 I can do a simple maths I can do seven times seven and press presenter and that will give me 49 so the 33 00:03:04,210 --> 00:03:07,410 shell Python Shell is interactive. 34 00:03:07,600 --> 00:03:16,420 If you want to print out text on the console you can use the print function Python comes pre-built with 35 00:03:16,420 --> 00:03:23,670 a print function that allows you to enter the text you want to be displayed on the screen. 36 00:03:23,710 --> 00:03:30,670 So those two a print from trying to do a print and then you have the parentheses inside the parentheses 37 00:03:31,110 --> 00:03:34,260 is where you specify what you want to print. 38 00:03:34,360 --> 00:03:36,310 You need to enclose that in quotes. 39 00:03:36,310 --> 00:03:38,100 So I just say hello. 40 00:03:38,750 --> 00:03:46,000 And you close the corpse and then you close the parentheses and you press enter and that will simply 41 00:03:46,000 --> 00:03:47,280 display the text. 42 00:03:47,320 --> 00:03:49,170 Hello and Python. 43 00:03:49,210 --> 00:03:57,590 A text or group of text is known as a string and you will know where the computer can understand it. 44 00:03:57,610 --> 00:04:03,880 If you put if you put quotes around them so you can't make the quotes you either you either surround 45 00:04:03,880 --> 00:04:12,530 the text with two single quotes or two double quote but you can't mix it with a single and a double. 46 00:04:12,580 --> 00:04:18,760 So it is worth noting that any time you want to print a text for the computer to know it's a text you 47 00:04:18,760 --> 00:04:30,110 need to enclose it in quotes to exit the python shell you just typing exit and you enclose that in parentheses. 48 00:04:30,430 --> 00:04:38,260 So you go to open in parentheses and close in parentheses and press enter and that will exit the python 49 00:04:38,380 --> 00:04:39,450 shell. 50 00:04:39,730 --> 00:04:45,150 Another way you can access the Python Shell is via the python. 51 00:04:45,160 --> 00:04:49,330 I'd always come pre installed when you install Python. 52 00:04:49,330 --> 00:04:54,540 Now this is a shortcut I have to the idol so I'm just going to click on it. 53 00:04:54,610 --> 00:04:59,160 You can also search for it in your search bar and that should bring that up as well. 54 00:04:59,620 --> 00:05:07,360 So I'm just going to click to open up the Idol and this is what the python ideal looks like and you 55 00:05:07,360 --> 00:05:13,290 can see it opens up straight into the python shell. 56 00:05:13,340 --> 00:05:19,510 So this is similar to the shell we had to look at earlier from the command line. 57 00:05:19,550 --> 00:05:19,880 All right. 58 00:05:19,880 --> 00:05:25,430 So those are a couple of ways you can access the python shell.