Intro to Idle
ACCESS the FULL COURSE here: https://academy.zenva.com/product/bite-sized-coding-academy/
TRANSCRIPT
Hello everyone, and welcome to your first official lesson of this tutorial. Here we're just going to become a bit more familiar with Idle, which is how we're going to build and run our Python programs, and we're going to build a very very simple input output type Python program, just so you can get used to the flow of things. So go ahead and open up Idle now. It should have been automatically installed with Python 3.6. If you're using a Mac you should be able to find this under Launchpads in your applications folder, simply select Idle and we'll just open up a new window. Now things will look a little different if you're using a PC, as will the rest of the tutorial, but you should see Python 3.6.5. Shell regardless of which program you're using. So this is what's called a Python Shell in which we can actually write and execute statements right away. Now this is great for kind of single line statements, for example if I wanted to just print something out I could say print, and then I could put in these quotes here something like Hello. If I press enter it's just going to compile and run that line right away. Now what this isn't great for is writing multiple lines of code and then having them execute complex logic. For that we might need a new text file and then we just run that text file, rather than doing everything in the Shell itself. So I'll show you how to set that up, let me just kind of get myself set up here, just going to open this up a little bit. And then we're just going to go into Idle and we'll select a new file. Command N also creates a new file for us if we'd like to do things that way. So let's just expand this out, okay, good stuff. Now it's usually a good idea to give your file a name right away, so I'm just going to go to File, with this window selected by the way, we're just going to go to File, we're going to go to Save As, and let's just give this guy a name and I'm going to call mine Hello, you'll see why very soon, and I'm just going to save it to the Desktop. Make sure it's a Python file with the .py extension, go ahead and click Save and now it should have renamed your file up here. Now, if we wanted to do pretty much the same thing that we did here, what we could do is actually to just run the same line of code, so just print something like Hello, okay. If I give this a Save, make sure I save it and the asterisk will disappear, and then I go to this guy, make sure that this window is selected. We can go to Run, Run Module, or just press F5. Okay, it will do pretty much the same thing. It restarts it and then it just runs that file there. In this case the results are exactly the same as with the first case. So that's great, but how is it different from just running it in the Shell? Well, in our case it isn't, what we can do is make this file a little more complex and what we'll do in our case is actually have it take in some input from the user and then do something with that input and then produce some output. So the way in which we take input in a Python program is through the input function. I'll show you how to use that in just a second, but let's just call our input something like input_name and we're going to set this equal to the function call to input, we'll open up the parentheses beside it and within these parentheses we're going to put a quote, or a couple of quotation marks here, and then within these quotations we're going to enter the prompt for the user.
Видео Intro to Idle канала Zenva
TRANSCRIPT
Hello everyone, and welcome to your first official lesson of this tutorial. Here we're just going to become a bit more familiar with Idle, which is how we're going to build and run our Python programs, and we're going to build a very very simple input output type Python program, just so you can get used to the flow of things. So go ahead and open up Idle now. It should have been automatically installed with Python 3.6. If you're using a Mac you should be able to find this under Launchpads in your applications folder, simply select Idle and we'll just open up a new window. Now things will look a little different if you're using a PC, as will the rest of the tutorial, but you should see Python 3.6.5. Shell regardless of which program you're using. So this is what's called a Python Shell in which we can actually write and execute statements right away. Now this is great for kind of single line statements, for example if I wanted to just print something out I could say print, and then I could put in these quotes here something like Hello. If I press enter it's just going to compile and run that line right away. Now what this isn't great for is writing multiple lines of code and then having them execute complex logic. For that we might need a new text file and then we just run that text file, rather than doing everything in the Shell itself. So I'll show you how to set that up, let me just kind of get myself set up here, just going to open this up a little bit. And then we're just going to go into Idle and we'll select a new file. Command N also creates a new file for us if we'd like to do things that way. So let's just expand this out, okay, good stuff. Now it's usually a good idea to give your file a name right away, so I'm just going to go to File, with this window selected by the way, we're just going to go to File, we're going to go to Save As, and let's just give this guy a name and I'm going to call mine Hello, you'll see why very soon, and I'm just going to save it to the Desktop. Make sure it's a Python file with the .py extension, go ahead and click Save and now it should have renamed your file up here. Now, if we wanted to do pretty much the same thing that we did here, what we could do is actually to just run the same line of code, so just print something like Hello, okay. If I give this a Save, make sure I save it and the asterisk will disappear, and then I go to this guy, make sure that this window is selected. We can go to Run, Run Module, or just press F5. Okay, it will do pretty much the same thing. It restarts it and then it just runs that file there. In this case the results are exactly the same as with the first case. So that's great, but how is it different from just running it in the Shell? Well, in our case it isn't, what we can do is make this file a little more complex and what we'll do in our case is actually have it take in some input from the user and then do something with that input and then produce some output. So the way in which we take input in a Python program is through the input function. I'll show you how to use that in just a second, but let's just call our input something like input_name and we're going to set this equal to the function call to input, we'll open up the parentheses beside it and within these parentheses we're going to put a quote, or a couple of quotation marks here, and then within these quotations we're going to enter the prompt for the user.
Видео Intro to Idle канала Zenva
Комментарии отсутствуют
Информация о видео
13 июля 2019 г. 20:00:00
00:02:59
Другие видео канала