Skip to content

Cyber Dojo Instructions

Xavier Villaneau edited this page Nov 4, 2020 · 2 revisions

We currently host our monthly challenges on https://www.cyber-dojo.org/. This page explains how it works.

This website allows us to run Python code online, so that newcomers do not need to install Python on their device. You are free to use your own tools if you prefer.

How to join

First, join the online Cyber-Dojo session:

  1. Go to https://www.cyber-dojo.org/
  2. Select "We're in a group", then "Join a session"
  3. Enter the ID that will be shared with the group at the time of the meeting, or on the Meetup page directly.
  4. An animal will be assigned to you, then you will be able to start coding on the next page.

Interface overview

On the Cyber-Dojo interface, you will see:

  • The editor (middle / bottom-right), which occupies most of the page and is where you will be coding.
  • The list of files on the left, click on a file to access it.
  • Your test run history (top bar of the page), which will be empty to start with. Tests are color-coded as:
    • green: all tests passed
    • red: at least one test failed
    • yellow: there was an unexpected error while running the tests

To try your code, click the "Test" button in the top-left. This will run the code in the test_ files, which should in turn run the code you wrote to verify that it works.

What's with the tests thing?

The Cyber-Dojo coding website is designed according to the [Test-Driven Development] practice. In other words: write the tests first, build the code after! We encourage you to do the same, but the choice is yours.

To add a test, add an assert statement in test_my_code.py, such as follows:

assert my_function_to_test(test_input) == expected_result

# Examples:
assert add_numbers(1, 2) == 3
assert is_even(1024)

The assert statement works by checking if what follows on the line is (or evaluates to) True, and throws an error if it is not.

More information:

General Tips

  • If you feel stuck, you can add print() calls in your code to see what's going on.
  • You can read other people's code! Click on the animal image in the top-left to access the session dashboard, and click on the other animals to access their code.
  • Don't hesitate to ask for help!
Clone this wiki locally