Python (Fall 2026) Module 2-5: S1 Sandbox Challenge
Overview
Bill Moseley introduces Python’s turtle module, a Logo-inspired drawing tool, to practice importing modules, issuing movement commands, and using variables. He builds a square with four 70-pixel sides, then shows how a variable and integer conversion of user input make the drawing size configurable.
Key takeaways
- Python’s turtle module provides visible feedback for movement commands: four forward movements of 70 units, each followed by a 90-degree right turn, draw a square.
- Assigning a shared dimension to intSide makes the square easier to resize because one variable change updates every forward movement.
- Python input returns strings even when users type digits, so int(input(...)) is needed when a drawing dimension must be an integer.
- Converting input with int() only works for numeric text; a response such as “twenty” raises an error.
- The sandbox challenge emphasizes exploration with turtle, including circles, forward and back movement, and right and left turns.
Chapters
- Python turtle traces back to Logo, a 1970s educational language associated with a programmable robotic turtle.
- The example imports the turtle module, creates a turtle object, and calls circle(100).
- Bill Moseley demonstrates the code in PyCharm because the external turtle module is unavailable in the online Python environment he discusses.
- Four repetitions of forward 70 and right 90 draw a square with 70-pixel sides.
- Storing 70 in intSide lets each forward command use the same value, so changing one assignment changes the square’s size.
- Moseley recommends experimenting with turtle commands to create other shapes and points to variables as a recurring course skill.
- The input function can ask a user how large to make the square, but it returns the response as a string.
- Wrapping input in int() converts a numeric response such as 300 into an integer usable as the side length.
- Entering the word “twenty” causes an error because int() cannot convert that text into an integer.
- Turtle also supports opposite movement commands such as back and left, and the turn angle can be supplied as an integer or float.
Transcript excerpt
0:01 So that brings us to today's sandbox challenge. And for the sandbox challenge today, I'm going to introduce you to something called the turtle module in Python. And turtle is based on something called Logo, which was created in the 1970s. And the reason it's called a turtle is because the original version of this actually had a physical robotic turtle. It was like this big, that you could program to draw lines on a giant piece of paper. And they used it to teach kids math, but programming with turtle gives us a lot of really interesting capabilities. So let's introduce that. I'm going to show you where to get to this. You don't have to do it right now, but I'm
0:52 just going to walk you through it. Obviously, it'll be on the video and uploaded to the class. So on most of our sandbox challenges, there's a lot of step-by-step instructions. And that's kind of on purpose. Usually it'll start out with a very step-by-step copy this or retype the code. Sometimes you copy and paste it, sometimes you retype it. It kind of depends on what you want to do. Sometimes it is useful to retype code by looking at it, because it gets you used to typing different commands and how they're put together. Sometimes copy and paste is just fine. But it'll explain how this code works. And so this is our first basic program. And so I am going to run this in PyCharm. You will not be able to run this in online Python
1:46 because it requires an external module, and that's beyond the capabilities there. So I'm going to create a new PyCharm file here, and I'm just going to show you how this works. So I'm going to create a new file
This is the start of the transcript. Save this video free for the whole transcript, searchable and time-coded.
In this course
Related notes
Summary, takeaways, and chapters were generated by AI from the video's transcript and may contain errors. The video belongs to its creator, Bill Moseley, Ph.D. - Computer Science Educator.