Python for Absolute Beginners Transcripts
Chapter: Code that interacts with users
Lecture: Creating a project with PyCharm

Login or purchase this course to watch this video and the rest of the course contents.
0:00 It's time to write our first program. We've written some Python code and we play around with it in the REPL but that doesn't really count.
0:08 What we want is something that we can save and run again on command and it just does whatever our program does.
0:14 We're going to do this using PyCharm Community Edition. So I'm going to go and launch that here. And PyCharm Community, is 100% free
0:22 and it's available on macOS, Windows and Linux. So you should be able to use this, no problem. There's also a paid version but we don't need it
0:29 for this course. We want to going to go create a new project and then we're going to create our M&M game. So we'll say, M&M.
0:37 Now it's suggesting that we create a new virtual environment. And lets just let it go ahead and do that here.
0:42 This is all fine. This is a way to create isolated environments. So if we install other libraries they don't interact or conflict with other programs
0:50 we might be working on. Technically it's not needed but it's the default. So I'm just going to go with it. Later, we might use that.
0:56 We'll talk more about it near the end of the course but right now we're not going to use other libraries so it doesn't matter. Right now, here we are
1:02 and we don't have any way in seeing You see over here this is grayed out. We don't have any way to run our program.
1:08 So lets go over here and create our first Python file. So go over here and say, Right click, save new add on file. And we can call it anything we want.
1:16 Lets just call it something like guessinggame, like this. So over here we have our little game. And lets just make sure everything's working.
1:24 Lets just do our little hello world trick. Like this, we'll just print, Hello world. And notice there's a little squiggly here.
1:30 PyCharm verifies that our code is meeting the Python standards. There's certain rules about how we should write our code
1:37 how we should name our variables and so on. One of the rules is it should end in a new line, blank line. If you hover over it, it says
1:44 No new line, the end of file. Then we'll just hit enter and that will go away. So there's nothing wrong with the program.
1:49 It just happens to be PyCharm saying this is technically probably going to work but it doesn't quite follow the standards.
1:55 Now in order to run this and use this little button that looks like it should run something you have to right click on the file and say
2:01 Run guessinggame or whatever you called it. And then it runs down here at the bottom. You can see, Hello world and any input
2:08 or other stuff that's going to happen is always going to happen in PyCharm down here. If you'd like to, you could always just copy this command here
2:16 and run it in the terminal, if you like. But for the most part just seeing the output happen down at the bottom is what we're going to need. Alright.
2:24 Well, this is creating our project. And yeah, it's not yet the M&M guessinggame but we're going to get there. But this is the first step.
2:30 Make sure that we can use our editor and save this stuff. This way we can make changes through our existing code
2:36 and re-run it and see the changes here. We don't have to like keeping typing it back into the REPL. Woo, that's a good thing.


Talk Python's Mastodon Michael Kennedy's Mastodon