[Logo for The C Shore Landing Page]
The C Shore

Getting Started With Mu

Table of Contents

Getting Started With Mu

Introduction

mu hello world

Mu is a very simple to use Python editor and IDE (integrated development environment) for beginners. It’s designed to be as user- friendly and helpful as possible for new Python programmers.





Writing code in Mu

The main area in Mu is where you will write your code.

Enter this code into Mu to create a ‘Hello world’ program:

print("hello world")

code hello world

Click Save to save your program.


Enter the file name hello and click Save.

save file


Click Run to run your program.

run


Your program will run, and the message hello world will be displayed.

hello world

Stop your program by clicking Stop.

Saving your code

Once you have saved your code to a file and given it a name, Mu will automatically save it for you every few seconds, as well as every time you run it. This means that you will probably never lose any work!

You can, of course, also use the Save button any time you want.


Modifying ‘hello world’

Modify the message from ‘hello world!’ and run the program (that is replace ‘hello world!’ with what you want to say — that is appropriate here of course).


Multiple programs

You can have multiple scripts open at the same time using the tabs.

Click New to create a new program.

A second tab will appear where you can write you new program:

mu tabs

You can switch between your programs by clicking on the tabs.


Code checking and debugging

Highlighting

Mu will try and help you create working code by checking your program and highlighting errors it finds to allow you to correct them.

The following line of code is incorrect:

print("hello world)

There is a " missing at the end of "hello world

If you run this program, you will receive an error message:

File "c:\users\martin o'hanlon-lt\mu_code\hello.py", line 1
    print("hello world)
                      ^
SyntaxError: EOL while scanning string literal

Mu will highlight code that it recognizes as incorrect.

mu highlights error


Checking

At any point while you’re coding, you can also get help advice from Mu without running your code: click the Check button to ask Mu to check your code for errors.

mu code check

When you have fixed an error, click Check again to see if the problem has disappeared.


Debugging

Unfortunately, not all problems with code are syntax errors (which Mu usually recognizes). Some errors in your code will be bugs, meaning your program runs fine, but it doesn’t do what you want it to do.

Mu has a debugger that allows you to step through your code line by line and look at what each line is doing. Information on this is available in the “Additional Information” section.

What next?

Check out the Mu website and the tutorials to learn more about this beginners’ IDE.