Python Jumpstart by Building 10 Apps Transcripts
Chapter: App 1: Hello (you Pythonic) world
Lecture: Building Hello world, part 1

Login or purchase this course to watch this video and the rest of the course contents.
0:00 So let's switch over to my Mac and get started. So to use PyCharm, it's pretty simple, you open it up, and you just say create a new project.
0:08 You can see there is a lot of different kinds of projects we can create, we are just going to do a pure Python app for our beginning one,
0:14 but you could create a Django, Flask, or Pyramid web app, even a Google App Engine app, and there is also a lot of HTML, Javascript options
0:22 because PyCharm is a full featured Javascript, CSS, HTML editor, in addition to being a great Python editor.
0:30 So I actually already have a project I created just by basically saying ok, on the next screen. And when you create a new Python app,
0:37 a pure Python app, you end up with basically a blank folder. So, we are going to come over here and add a new Python file,
0:44 so right click and say new Python file, and throughout this class, the main program that you'll run,
0:51 that indicates sort of the entry point into this set of scripts, or Python files that we are building, is going to be named,
0:59 so I am going to create something called, I am using Git to store all the files and demos that I create for you during this class
1:06 which I will make publicly available for you to look at and see how they have evolved over time and you can see that PyCharm is actually suggesting
1:13 that we add this to our Git repository I was going to tell it to please don't ask again. Now, remember, the first thing that our little sample app had
1:21 was it had a little header with some dashes and it said "Hello App", and it sort of was bracketed by kind of a dashed line above and below.
1:28 So let's go back creating that. So we are going to use something called the print function.
1:33 And this is typically the way that you output things to the console. We can say print, and then here we can put s a string.
1:40 And in Python, you can create string with double quotes, like this " " or you can create strings with single quotes, like that ' '
1:47 and I actually prefer the single quotes, it's just a little less typing, you'll see there is some times you might want to use double quotes,
1:53 you might want to use single quotes, we'll talk about that later. So, we are going to come over here and we are just going to have our dashes like so,
2:01 and then we also want to output that little "Hello App" part, so we are going to come here and say print, go over and say hello app,
2:11 I think pretty much like that and we are going to say print, I am just going to do this one more time.
2:17 Let's go and run this and make sure there is some reasonable output, first thing to do is save this.
2:22 Now I could go to the console, to the terminal and just run that, I can easily do that by saying copy path, we go down here and I can type Python 3
2:31 and I can just give it a path, add hit go, and then out comes our output, hello app, perfect. But, PyCharm let us run this, and debug it, and do
2:40 all sorts of cool runtime analyses of our app, right from within PyCharm. And you see there is a little debug icon here
2:48 and a little play icon here, but they are both grayed out, and that's because there is no run configuration setup. So instead of going over here,
2:55 we are just going to right click and say run the program and it will create a run configuration and save that for us going forward.
3:03 So just like before in the terminal, we have hello app, very very nice. We also maybe want a little space between here,
3:09 we can actually just call print with no arguments, and I will just do a new line. Now, the next thing that we did in our app was
3:16 we actually asked the user what their name was. So we could actually get down to the system input output streams and directly work with those,
3:26 but in Python there is a simpler way. We can just say input, now this also takes a string, and we can say something like "what is your name?"
3:36 put a space and then, in the console the cursor is just going to stop right there and wait for the user to put some inputs,
3:42 so let's just going to run that, I can click this, or this or I can say control r "^R", in Windows, I believe that's F5,
3:52 and on the Mac it's control R "^R", and down here you can see it's asking what my name is, I'll say my name is Michael.
3:58 Then, it waits and when I hit enter, it accepts the input and moves on. Now, that's not super helpful because we are not actually getting the name,
4:06 we are just asking the question. So, let's take a moment and look at a couple of core concepts that we are working with here.

Talk Python's Mastodon Michael Kennedy's Mastodon