about | help | home | prefs | create account
CodingBat code practice

Latest News

CSS improved for mobile, added font-control on edit page. Ctrl-enter now works on te problem edit pages. We're working HTTPS support, but it'll be a while still (now done).

New functional sections: Functional-1 and Functional-2 sections using Java-lambda.

email nick with any bug reports or suggestions


CodingBat Help

CodingBat is a free site of live Java and Python coding problems to build coding skill. Each problem has a problem description and a table showing some sample output for that problem. Type your Java code into the large text area and click the "Go" button to save your code, compile and run. Each time you click Go, the results are shown in the right side of the page. On each problem page, the "prev" and "next" links lead through the sequence of problems in that section. The "chance" link goes to a random unfinished problem in the section.

The problems in each section get harder towards the end of the section. Some of the problems (marked with an "H") have hint text and/or the solution code available. In particular, all of the problems in the "Warmup" sections have solution code available, so that's an easy way to get started.

Code Help

See the Code Help+Videos page for many help pages and videos on various coding topics.

Code Ground Rules

Your code should just be a simple method or function with the prototype just as it is in the starter code. The code should compute and return a String or int or whatever value (don't print the result value, return it). If the method takes a String or array argument, those arguments will never be passed in as null. However, the empty String or array is still a valid case unless the problem statement specifically says otherwise. You may write helper methods, although most often, the problem can be solved in with code short enough to fit in one method. In Java, the import for the java.util classes is already done if you would like to use those classes. Python code should not print and should not do any imports.

Run Green

When your code compiles and runs correctly, you get a green check for that problem. If you click the Back button to go to the home or section page, you may not see the green checkmark right away, since the browser is caching the old version of that page. Hit reload to get the current version of the page (or use the links on the problem page -- those always get you the up-to-date version). Three checkmarks in a section earns a gold star for that section. If the output of a run says "Timed out", your code probably includes an infinite loop or other bug that prevents it from finishing.

There may be a few "other tests" listed at the bottom of the table but which are not detailed -- these additional tests are similar to the ones shown in the table, but with different numbers, strings, etc. filled in.

Saving Work with Accounts

If you create an account, you can come back to the server another time and your code, and you checkmarks, etc. will be saved. You can do everything on the server without an account, but your work will be forgotten when your session ends after 2 hours without activity.

If you play around on the site for a while creating some code, and then create an account ... it will do the right thing about putting your existing code under the new account.

Done Page

Each account/session has a done page that lists the problems that have been completed. The done page for each account has its own url, which is private by default. However, you can share or post the done page url, and then anyone can see the list of done problems. The done page was an early, simple way for students to share their progress with their teachers, however the Teacher Share features below are now a better solution for that.

Code Badges

Part of the Done page, earn badges on fundamental coding topics: Code Badges

Progress Graphs

The progress graph feature draws a graph of the course of each problem, and graphs from random users are available just for fun.

Teacher Features

An account can share all its information with a "teacher" account. Use the Teacher Share section in your preferences to enter the CodingBat account email address of your teacher. Also in your preferences, you can enter your name -- this can help the teacher read the done statistics more easily than just seeing email addresses.

Teachers: Tell your students to share to your CodingBat account. Use the 'report' link at the top of the home page to see a table listing all the students who have shared with you (this link appears when someone shares to your account). The report page lists all your students, showing the count of done problems for each student across all sections. Each account has its own 'memo' field preference, blank by default. You can ask your students to enter something in the memo, e.g. section-2, to help organize the grading report.

You can click through to see their detailed problem done list and progress graphs. If you think a student is cheating, looking at their progress graphs can be very informative. Probably the best teaching strategy is to leverage CodingBat for lots of practice, but not too much for grading data. Get the grading data from exams with CodingBat-like problems, so the practice is both motivated and rewarded.

By default, each problem in each section is simply worth 1 towards the student's total. You can also enter a custom scaling factor for each section. If you enter "2" for the String3 section, then each done problem in that section will count as 2 points instead of the default of 1. You can use this feature to reflect that you value problems in some sections more than in others, however it's probably a good idea to keep to a simple scheme. You can enter "0" as a scaling factor, in which case problems in that section will not count towards the total.

From the report page, clicking on the student's id takes you to their done page which lists all their completed problems. From the student's done page, clicking on a problem shows you the student's code for that problem. Seeing the student's code only works using the links from the student's done page.

The report page also has a filter control so you can select between java/python student problems, and "stock" problems from the front page vs. custom written problems. Only sections (e.g. java.Logic-2) where a student has done a problem are shown in the table.

Authoring Feature

CodingBat has a basic authoring feature where anyone can write their own problems. Access the Author page to try it out, and see the Authoring Docs.

Authoring Report

On the report page, a teacher can enter the url of a custom page, such as "/home/nick@example.com", and the report will switch to tabulating just the problems from that page. This is an easy way to assign a specific set of problems, and then get a report about just those problems.

The Remove ID button at the bottom of the report pages allows the teacher to remove a student from their report list.