Day: March 15, 2018

PyCharm Edu review

No Comments

PyCharm Edu is an Integrated Development Environment (IDE) for python which has the additional ability to run courses for learning python programming. It also enables teachers to create those courses. PyCharm Edu is cross platform, running on Linux, Mac and Windows.

At CoderDojo I am mentoring ninjas in coding python so I thought I would try PyCharm Edu. To create a course, I created a series of tasks. Each task is a python program with sections left out to be completed by ninjas (answer placeholders). A task has a task description to explain to the ninjas what to do, and a series of tests to determine when they had completed the task. Each answer placeholder has hints to help solve it, some text which needs to be replaced by the ninja and even the correct answer. The tasks have to provide enough information for the ninja to understand what needed to be done, but not enough that the answer was trivial.

Writing the tests was challenging. The tests needed to check for all possible correct answers. For example, if the correct answer was “x+y” then I should also accept “y+x” or “y + x”. I solved this problem by using the python eval() or exec() to test the value of functions or the effect of statements rather than compare the exact characters typed to the answer.

For example, here is how I used eval() to test for where the correct formula should be (x+y).

def test_formula_1(ninja_answer):
    list_data = [{"x": 5, "y": 15}, {"x": 10, "y": -5}]
    global_data = {}
    correct_answer = "x+y"
    for data in list_data:
            guess = eval(ninja_answer, global_data, data)
        except NameError:
            failed("NameError: should only be in terms of variables " + ",".join(data.keys()) + " but includes other variables. Your formula: " + ninja_answer)
            return False
        correct = eval(correct_answer, global_data, data)
        if guess != correct:
            failed("Incorrect answer for data " + str(data) + ". Correct answer: " + str(correct) + ". Your answer: " + str(guess) + ". Your formula: " + ninja_answer)
            return False
    return True

The types of tests I used to check for correct answers were

  • Exact match – when a string value or number value had to be exact
  • Partial match – when only start of string or end of string important
  • Formula correct – using eval()
  • Statement correct – using exec()
  • Printed output correct
  • Effect of program – eg results in Minetest world

When the ninja (student) is running the course they have access to a full python IDE, including command completion and debugging. As a teaching aid one of the most useful features is the console where ninjas can test individual python statements. The console has a sub-window showing variables created in the console and their values, great for teaching how variables work.

The ninja can see the code for the current task and a task description describing what they have to do. In the diagram below notice the sections of code with thin rectangles around them. These are the answer placeholders that the ninja needs to replace to solve the task. They shouldn’t need to type outside these rectangles, although they can if they want to embellish the program.

While attempting a task they can do the following actions:

  • Get hints on an answer
  • Reset the task to undo all their changes
  • View the answers (after which they must reset the task)
  • Run the program with output going to a local window (ctrl-shift-F10)
  • Check the task which assesses how well they have done by running tests
  • Advance to next or previous task

Advantages of using PyCharm Edu over web python tutorials or text editors:

  • Course can be customised
  • Student learns a proper IDE. Useful for developing bigger python projects later
  • Python console with variable values display
  • Syntax colouring and formatting recommendations
  • Command completion
  • Logic checking such as:
    • variables declared before used
    • import statements used or missing
    • spelling of function names and variable names
  • Python virtual environment support
  • Automatic installation of modules listed in requirements.txt either from pypi or LAN
  • More reliable and functional than Python IDLE
  • Better debugging than Thonny

Problems with PyCharm Edu

I did find some problems with PyCharm Edu. However, Jetbrains have been excellent at responding to my issues in this free software.

  • PyCharm Edu is usable but expect occasional hang or lack of responsiveness.
  • PyCharm Edu turns off a lot of menu items by default to avoid confusing new students. They can be turned back on in preferences.
  • PyCharm Edu and PyCharm Community Edition don’t have the same support for flask or django development found in PyCharm Pro. I was still able to do some flask development.
  • Unable to display local images in task descriptions. This feature is apparently coming in an update due in a couple of weeks.
  • “Play” button for running tasks mostly didn’t work. However, ctrl-shift-F10 achieved the same functionality reliably.


PyCharm Edu is my choice of tool for teaching python and I am sure most of the problems will be addressed in time.

Categories: CoderDojo, Minetest