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