Skip to 0 minutes and 6 secondsSo now I wanna tell you a little bit 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.

Skip to 0 minutes and 43 secondsBut 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,

Skip to 0 minutes and 55 secondsand 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...

Skip to 1 minute and 33 secondssay open("mbox-short.txt"),

Skip to 1 minute and 42 secondsthat 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 orange.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())

Skip to 2 minutes and 11 secondsThis 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."

Skip to 2 minutes and 36 secondsAnd 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

Demonstration: Using the Python Playground

Share this video:

This video is from the free online course:

Programming for Everybody (Getting Started with Python)

University of Michigan

Get a taste of this course

Find out what this course is like by previewing some of the course steps before you join: