Creating and Running a Code Snippet
00:12 REPL stands for Read-Evaluate-Print Loop. This is what happens when you have your Python console open and you’d type something in there—it reads, evaluates, prints, and then loops back to the beginning.
00:22 So that is what this is based on, where the name comes from. And again, there is other online coding environments, but the idea is the same, and this is a very nice one, actually. On the main page, now I’m going to show you that you don’t even have to have an account.
00:36 I’m not even logged in right now and I can go and click on make a new repl. Then it suggests me languages. I can just type it in and say, “python”, I want to use Python—not the legacy Python but just Python 3.
00:50 And then I create this Repl. That’s really all I need to do, and here I have my integrated development environment ready for me in the cloud. Here you can see, we have a file structure here on the side.
I’m going to put this away for now. I don’t want to deal with that right now. All I’m interested in is my place for writing the script—the text editor—and then the output in the terminal. Let’s go ahead. I have this
main.py, and let’s go and write this loop
for x in—and you see, we have again autocompletion, so it’s suggesting me to put
range() in here, which is what I want to do, so I just press Enter and put in here
5. Also, very nice—we get all these suggestions.
01:49 So, I don’t think there’s really a way of increasing the font size in here, but you can increase the browser font size in general, just pressing Command + Plus. It makes everything a bit bigger.
01:59 That’s just zooming in on a browser, right? Well, maybe that makes it a bit better visible for us. So, I have this loop in here and now I want to run it, so pressing up here executes it, and we have our results over there in the terminal.
02:41 They can access it and they can clone the Repl and continue working from the code that you wrote. So it’s a great way of working interactively and working collaboratively on some code. It’s easy to share. And that’s really the main thing about it.
02:55 We don’t need to install anything, we can just go there, create a Repl, decide what’s the language that we’re using—we’re using Python—write the code here on the left side, press this to run it, and then we can also share. So here, for example—the link, copy it, send it to your friends, and that’s it! They can access it.
03:13 They can run the code, see the output. It also has lots of other features. It’s actually a very sophisticated environment. And in the next video, we’re going to take a look at how does debugging work in an online environment like this one. See you there.
Become a Member to join the conversation.