Coding
Repl.it
In this module, we’ll be making use of Repl.it, an online IDE (integrated development environment) for Java and Python. It’s a way of writing code and running it right in your browser. You will see embedded runable code windows in the course. They look a bit like this (in Python):
You are also able to open the code in a full window by clicking the button in the embedded Repl.it frame. You can save your code by creating an account on Repl.it.
Click “Fork” to save it to your own Replit account. You can share your replit with me by clicking “Share” and inviting me (davidgundry
on Replit).
You can find all the code for this course on Repl.it
Running Unit Tests
Several of the exercises give you a number of pre-written unit tests. These unit tests are to help you know when you’ve got the right answer. But just because the tests pass does not mean you code is correct - they are necessary, but not sufficient. It is possible to write code to pass the tests but not answer the question you’ve been given! Don’t do that!
The assessment for this module will involve writing code. I will provide unit tests for this as well, so it’s a good idea to get the hang of how they work as you make your way through the course.
Java
Projects with unit tests will have some extra files containg tests and some code in the main()
method of the Main
class for running them. You can see what the tests are doing by looking in the test files, which you can find through the “Files” icon in the menu on the left of the screen.
Python
You can tell a project has tests because there will be several additional files, including tests.py
, and a .replit
file. You want to write your code in main.py
. It will likely show the wrong file by default! Click the “Files” icon on the vertical menu bar at the left side of the frame to switch to main.py
.
When you run the project in Repl.it, it will run the tests. Make sure you name your functions correctly (as the question tells you to) so the tests can find them. Give it a try here (remember to change to main.py
using the file menu):
- Previous
- Next