If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

Using the development environment

Get to know the features of the Khan Academy programming platform. Learn how to use the code editor and the console, how to create spin-offs, and how to ask for help.
So, we're ready to start programming, but how do we do that? Let's get set up with the right programming equipment.

Using a development environment

Most programmers use integrated development environments (IDEs) to create their programs. IDEs combine tools for writing, running, and testing code into a single platform to make it easier and faster to get our work done.
For this course, we'll be using Khan Academy's online Python IDE.

Writing code: the code editor

The first thing we'll need is somewhere to write code. A code editor is a text editor specialized for a programming language.
Code editors work just like your favorite docs app. We type in it and text appears - nothing fancy here. But, instead of English, its built-in tools observe the rules of a particular programming language.
A user types in the Khan Academy code editor. An unmatched quotation mark pops up a linter error, and a line over 79 characters long pops up a linter warning. Typing, "in," autocompletes to, "input()".

Syntax highlighter

You'll notice that different words, numbers, and symbols appear in different colors. This is called syntax highlighting. The code editor uses colors to make it easier for us to distinguish between different components of our program.
Imagine if your docs app colored all nouns green, all verbs blue, and all adjectives orange. That's what the syntax highlighter does, but for different elements of the Python language.

Linter

A linter is like Python spell check. If we type something it doesn't recognize as valid Python syntax, it'll underline it and pop up a symbol in the left sidebar. If we hover over that symbol, it'll show a message explaining the issue.
Notice that there are two types of symbols: a red circle means error and a yellow triangle means warning. Errors mean our program is broken or invalid. Warnings help us write programs with good style and clarity, like a writing assistant. They'll warn us of things like, "Hey, this is an odd place to put this," or, "Hey, this line is really long and hard to read."

Autocomplete

If we start typing in the editor, we may see a dropdown pop up with suggested words. This feature autocompletes common Python keywords and names, so we don't have to memorize them all. We can then click (or use the up and down arrow keys) to select a suggestion.
You may not recognize many of these suggestions just yet, but as our programs get larger, we'll start to rely on them more. For example, as our Python vocabulary grows, we may want help remembering: was that thing I needed called len() or length()?

Running code: the console

Now that we've written our program, what do we do with it?
A user runs a program in the Khan Academy IDE by pressing the Run button. An interactive input prompt appears in the console that the user responds to. The user edits the code and runs the program again, and this time a red error message appears in the console.
At the top of the IDE, you'll see a big green Run button. When we press Run, it submits the program to the computer to execute. Think of this like handing in an assignment; we're telling the computer that we're ready for it to take a look now. In this case, though, there's no penalty for mistakes, so we should run our program early and often!
As it executes the program, the computer displays any results in the console. This output then stays displayed in the console until the next time we press Run - it does not automatically update.
Console output might be a result that the program asked the computer to display, or it might be an error that the computer encountered while executing the program. Not every program has output, so it's also possible the console stays empty.

Programming on Khan Academy

We designed these features specifically for the Khan Academy IDE, with learners like you in mind!

Spin-offs

The spin-off feature allows you to make a copy of a program, while still giving credit to the original creator. This is a great opportunity to experiment with programs that you're curious about or build off of programs that you're inspired by. Changes you make to the spin-off program are entirely your own; they won't affect the original program.
The Spin-off button is available on all public learner-created programs, as seen in the program galleries, and on all course Projects. The Spin-off button unlocks on a Challenge after you complete it.
When working on bonuses or creative extensions within the course, we recommend creating a spin-off first so that you don't risk breaking your Challenge or Project solution as you explore.

Getting help

Ask the community

If you're stuck, you can always ask for help from the Khan Academy community. The community can help track down tricky errors, suggest ways to improve your code, or brainstorm how to build a specific feature.
To request help on a Challenge bonus or a Project, you first need to create a spin-off. This makes your program code publicly visible so that others can see what you're working on. Then, navigate to the Questions tab on your program page and submit a help request.
The Khan Academy community will then make their best effort to answer your question. As you grow your Python experience, you can join in by answering other people's help requests, too! To see all unanswered help requests, press the Help requests button on the course home page.

Ask Khanmigo

If you have access to Khanmigo, Khan Academy's AI-powered tutor, you can ask it for programming help. On any Challenge or Project page, open the Khanmigo chat window and start a conversation!
Khanmigo can see both the instructions and your code and offer suggestions based off of them. For example, you can ask, "Help me with this error," or, "Where do I start?" As you make changes to your code, Khanmigo keeps up and can offer personalized help based on where you are in the programming process.

Keyboard shortcuts

The code editor supports a number of keyboard shortcuts to make it easier to navigate.
ActionMacPC
UndoCmd + ZCtrl + Z
RedoCmd + Shift + ZCtrl + Y
CopyCmd + CCtrl + C
PasteCmd + VCtrl + V
Select allCmd + ACtrl + A
FindCmd + FCtrl + F
Save*Cmd + SCtrl + S
Move cursor to start of lineCmd + ←Ctrl + ←
Move cursor to end of lineCmd + →Ctrl + →
Move cursor to start of fileCmd + ↑Ctrl + ↑
Move cursor to end of fileCmd + ↓Ctrl + ↓
*

Want to join the conversation?