From the course: Python for Non-Programmers

Your first line of code - Python Tutorial

From the course: Python for Non-Programmers

Your first line of code

- [Instructor] Hi and welcome to Python for Non-Programmers. If you're starting from square one, you're in the right place. Now the great thing about learning Python, which is the most popular programming language in the world, is that you can run it almost anywhere. On Windows computers, Mac computers, Linux and even on the internet in your browser. And for this course, to help us dive in and learn as quickly as possible, we're going to be typing and learning our Python code in the browser. So I'm going to be using the website replit.com and I'd encourage you to use the same website as me. However, if you'd like to use your own setup, you can go Google Python online and you'll see lots of different websites that offer the same service of being able to run and test and see Python code in your browser. So if you're going to follow along with me and use replit.com, go ahead and create an account and hit the Sign Up button and join me on the other side. Alright, now that you have created an account here in Repl, we need to create a new Repl, which is essentially a new file to test out our Python code. So the website will likely change over time, but you can see over here on the left, I have Create Repl, and also in the top-right, we have a Plus button to create a new Repl. So however you need to, create a new Repl. Then we need to select Python as our programming language and then give a title to our Repl. Again, we should have a new Repl for each different video in this course for each concept that we're learning. So let's go ahead and name this video First Line of Code, okay. Hit the Create Repl button. And in a second here, Repl will get our environment set up for us. Again, this is the place we'll be able to type out and see the results of our Python code. So here, where we have main.py, this is our Python file, Python files have the .py extension. Let's go ahead and type our very first line of Python code. So I'm going to type in all lower case, print, and then do an open and closed parentheses. You'll notice by just doing the opening one, Repl is smart enough to create the ending one. It's a nice little thing for us there. Then we're going to add some double quotes and then type inside of here, Hello World. It's typical when learning a new programming language to get the term Hello World to display for your very first thing that you do in the language just to make sure that you have the beginnings working. So once we have that there, we're going to hit this Run button up top and we should see, over here on this black box over here, which is called the console, the term Hello World. And if we type something over here, like Hello Nick, we should also see that go in the black box once we hit the Run button. So I hit the Run button. We now see Hello Nick. Awesome, you have your very first line of Python code. Give yourself a pat on the back. Now a few housekeeping tips here. With Repl, if you want to change the font or the color of things inside of your browser, you can come over here to the Settings icon and change things like the font size and you can also change the color and how things look. So if you want to customize anything, this is the place to do it. So with that in place, let's go ahead and move on to learning our very first concepts in Python.

Contents