Skip main navigation

Demonstration: Using the Python Playground

Demonstration: Using the Python Playground
6.4
<v ->So now I wanna tell you a little bit</v> about what we call the Python Playground. So the Python Playground is here in week two and it’s down here in Python Playground. It’s an exercise, but it’s not a graded exercise. So if you look at all the other exercises, they have a grade. But when you go the Python Playground, let’s get there, get to the Python Playground. So the Python Playground, as this word says, it’s an open-ended space for you to write and execute Python programs. And so the idea of all the other ones is there is some goal. On the right hand side there’s like a what you’ve done and then what it expects.
42.5
But in this one, there’s no expectation. It’s not an assignment, it’s just a place for you to write code. And so you can just write anything you want, print,
55.1
and then you can run it, all right? (beep) And so there you go. So this output runs and away you go. Now why would you wanna use this? Well, again, we encourage you to install Python yourself on your computers and do all your testing and playing around, but some of you aren’t gonna have computers. Some of you are just like using iPads or a computer in the library or a computer at your school and you can’t install software. So this allows you to play with Python programs. When you get to the point when you have files, there are files that you can open here. And this is the very beginning of the class, but if you…
92.9
say open(“mbox-short.txt”),
102.2
that actually doesn’t print anything out, but there are three files that, (laughs) yeah, your program doesn’t have any output, exactly. There are three files that are used in the textbook, mbox-short.txt, romeo.txt, and words.txt that allow you to open them in this little environment. And actually I can print them out, I can do this. print(open(“mbox-short.txt”).read())
130.7
This is too complex, but watch this. See, it just printed out that file that I read. So that’s one line to open a file, read the file, and print it out. And so there you go. And again, you can use this to interact with your teaching assistants outside of one of your graded assignments. Sometimes you’ll be working on something, you’ll go into Python Playground and then you’ll tell your teaching assistant, you’ll say, “Hey, I’m in Python Playground “and my name is so and so.”
156
And they will come in, they’ll get an extra button here and they can go find it and they can look at your code in Python Playground and then you can interact with them without having to post your code to the forums to get help. And so it’s pretty easy, you’ll use it for your own purposes. I don’t have any goals with it, I just wanted to make it so that you had availability of an open-ended place to run Python, okay? Hope you find it useful.

Demonstration: Using the Python Playground

Note: When utilizing the Python Playground for assistance, please include your Learner ID to facilitate easier communication between Learners and Mentors.

This article is from the free online

Programming for Everybody (Getting Started with Python)

Created by
FutureLearn - Learning For Life

Our purpose is to transform access to education.

We offer a diverse selection of courses from leading universities and cultural institutions from around the world. These are delivered one step at a time, and are accessible on mobile, tablet and desktop, so you can fit learning around your life.

We believe learning should be an enjoyable, social experience, so our courses offer the opportunity to discuss what you’re learning with others as you go, helping you make fresh discoveries and form new ideas.
You can unlock new opportunities with unlimited access to hundreds of online short courses for a year by subscribing to our Unlimited package. Build your knowledge with top universities and organisations.

Learn more about how FutureLearn is transforming access to education