Locked learning resources

Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Locked learning resources

This lesson is for members only. Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Other Useful Features - Replit

00:00 Okay. So after debugging, let’s take a look at a couple of other useful features that are built into this online Repl.it IDE. We’ve seen there’s a couple of things here on the site, and the first one we’re going to look at is Files.

00:14 You’re not actually restricted to just this one file, the script that we’re running here, but just as you could do on your computer locally, you can create additional files! And it works in the same way as it would there.

00:26 So I make this hello.py file, for example. It opens it up for me here in the editor. Let’s just define a variable in here. Yeah. And I can go ahead and import this in my other file, so I hop over here and I say from hello—and you see the autocompletion already knows that this exists. From hello I want to import

00:50 name—and there it is! And now I can print it out in here.

00:57 Run this, and my name pops up for our program. So, this is pretty cool, right? You can create folders, you can create additional files, et cetera, et cetera. You can delete them.

01:09 So, anything that you could do in a normal file system as well, which makes it pretty powerful—there’s a lot of stuff you can build like that. And it gets even better. Let’s look at the second one here, Packages.

01:21 You can also install external packages and use them in there, so it has your normal Python standard library by default, but we can also install other things—for example, the requests package.

01:33 I just saw it. requests, there it is.

01:38 So I click on this + and it’s going to install requests for me.

01:43 It does this a bit differently, like, it creates a requirements.txt file that we can now see sitting here in our file system, but we don’t have to worry about this.

01:52 We’ve got requests installed. We can click that away. So now you can go ahead and say import requests and autocompletion shows it to us already.

02:03 Let’s do something very meta now, okay? I’m going to take this URL of this same page—let’s go get it. res (response) equals requests.get(). Just to prove to you that this is working, pop in the URL, and then we’re going to print out res.content.

02:26 Okay. So if I run this now…

02:31 you see here, ha, it fetches the page content from the internet. And yeah, this is a bunch of unintelligible stuff, because a lot of it runs on JavaScript.

02:40 But you can see that the import of requests worked correctly. We’re fetching this internet resource—that is our own script right here!—from the internet and printing out the .content.

02:50 And then afterwards, our code runs, the little for loop that gives us those squares. So, that’s maybe a fun thing, but the takeaway is you can install all sorts of external packages and work with them in here as you would locally. So something else—this is also a nice feature here, auto-format. For example, let’s say I’m writing my code not very nicely, or I make some mistakes in here.

03:13 Maybe I have too many lines here, yeah? I can click this auto-format and it shapes my code nicely, according to PEP8—I assume—but it looks good.

03:26 Okay, so auto-format. What else do we have here? Multiplayer mode. I’m not going to go into this now, but just so you know, this exists and they’re working on it to improve it also. This allows you to actually collaboratively edit a file, so a couple of people could be in the same file and we could all be typing there and collaboratively editing a code example that can also run and see the execution of together, everyone at the same time over the internet.

03:52 So that’s pretty awesome. All right, and the last thing here we have—also, you can change the theme. So I mentioned before, we have this on the left and this on the right side.

04:01 If you prefer to have it stacked, you can do that. You can change your theme to dark if you prefer that.

04:09 So it’s even somewhat customizable in terms of the layout, which is pretty cool! Yeah. And one more thing I want to show you, like, because we’re working on the internet, so that gives us a lot of opportunities to share the code.

04:23 And so I want to do something else meta. I’m in a meta mood. I’m going to get this <iframe> here, because we can embed this Repl for other people to see, and another thing I want to show you is that you can work with this not only using Python, but lots of other languages.

04:39 So we have here Django, Node, C, Java, C++, et cetera. There’s tons and tons of languages that are supported. And among other things, also HTML, so I’m just going to make a little meta HTML page

04:56 to show you how this embed works. So you see, again, we have a couple of defaults. JavaScript, a style.css, and an HTML page. And here in the <body> let’s put in a heading.

05:14 All right. And then I’m pasting the <iframe> of this Repl that I just created before. So, now let’s look at this. How does this page look like?

05:27 Ha, there you go. We have the heading that I just created, and in the <iframe> in here, we can actually see the Repl that I just made before. And I can edit it, and I can run it and see the output.

05:46 There you go. So, that’s pretty cool! You can make your little code examples, you can embed them into your HTML page. People can go to your page, to your blog, maybe, they can run your examples and just execute them, make copies of it, edit it forward.

05:59 So there’s this whole explosion of sharing that comes along when you’re doing things on the internet, and that’s obviously great with an online coding environment like Repl.it.

06:10 So, this brings me to the last point, which is the community. If you have an online thing where you can create code, there’s obviously also a lot of other people involved.

06:20 So you can check out—there’s a form up there, there’s questions, you can see other people’s code. You can comment on it, you can edit their code. There’s very cool projects that you can check out. Yeah, I mean, that’s the big advantage of having an online community—that there’s a lot of people involved and a lot of people make cool stuff. Okay, so I think that’s all I wanted to show you in terms of the other cool functionalities with Repl.it. Make sure to check it out if you’re interested. And yeah, this is an example for one of those online coding environments that exist.

06:52 There’s of course other ones as well. And if you have the need to maybe share some code with friends, think of this—that this is an option that’s probably going to work better and more effectively than sending your code by email. Okay.

07:05 In the next and last video for this section, we’re going to talk about what are good ways to learn more about how to interact with an online coding environment. See you there!

Become a Member to join the conversation.