Table of Contents
Getting Started With Mu
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:
Click Save to save your program.
Enter the file name
hello and click Save.
Click Run to run your program.
Your program will run, and the message
hello world will be displayed.
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).
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:
You can switch between your programs by clicking on the tabs.
Code checking and debugging
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:
There is a
" missing at the end of
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.
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.
When you have fixed an error, click Check again to see if the problem has disappeared.
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.