Codingbat Python

CodingBatCodingbat Python code practice

Code Help and Videos >

Python Example Code

1 - Cigar party. CodingBat - Python. Contribute to abdullahaalam/CodingBat development by creating an account on GitHub. 1 - Count evens.

This page shows a few Python example functions to go with the CodingBat Python problems.Examples:

If Boolean

Python boolean operators are spelled out as the words 'and' 'or' 'not', instead of the && syntax in other languages.The following a_bigger() function should return True if the int parameter a is larger than b by 2 or more.

Notice that the if-test does not need to be in parenthesis, unlike many languages. Forgetting the colon ':' that follows the test is a very common mistake when first learning Python.

Another technique is to return True with one more tests in the body of the function, leaving a return False at the bottom. In some ways, this is simpler than an if/else structure.

See the Python If Boolean doc for more information.

Python Strings

See the Python Strings doc for more information.

The list example below shows another way to loop over a string or list using index numbers.

Python Lists

See the Python Lists doc for more information.

None Result code practice. Copyright 2016 Nick Parlante.

My guess is if you’ve been teaching computer science for a while, you’ve probably at least heard of CodingBat.

If not, it’s a big, and always growing, library of Java and Python practice problems. It’s also the first online tool that I used when I just started teaching computer science. Having a ready made collection of problems took a lot of stress away those first couple of years.

The Good

Lots of Problems

There are tons of problems on CodingBat. Last time I counted it was over 200 just for Java, plus many of the same problems rewritten for Python.

Before tests and leading into the AP exam in May I link to problems so my students have plenty of stuff to work on.

New Stuff

The pace that they’re adding new problems has slowed a bit. But as many as are already there it’s probably getting tough to come up with totally new problems. The collection is still growing though. There’s new problems added fairly regularly.

They’ve also added Mapproblems to the Java side a few months ago. Or, at least, that’s when I first noticed them. Great for those data structures classes.

And I was way more geeked than I would like to publicly admit when they added Python problems a few years ago.

Codingbat Python Logic 2 Answers

Online Editor

Online editors are pretty common now, but when I first started using CodingBat having students able to write their code directly on a website was a big deal.

They’ve improved the editor as well. When it first went online it was just a generic HTML textarea. It’s since been upgraded to use a proper editor with tab support and syntax highlighting.

One button and students can check their work. Python tkinter.

It’s Fast

Not sure what they’re doing on the back end, but CodingBat is really fast when you test a problem. Can’t really verify this, but I assume it’s not actually compiling and running the code. My guess is that it’s somehow parsing it without actually running it through javac. It just seems to fast to be compiling.

Make Your Own

The instructions are a little buried, but it’s possible to make your own problems for your students.

I’ve done this a few times. And once you’ve gotten through the learning curve of the first couple it’s pretty fast and intuitive.

Just go try it

Okay, I’m going to stop the list of good parts here. Each time I’ve added a section I’ve thought of at least one more. So if you’ve never tried CodingBat, go give it a shot.

The Bad

To quote Randy Pausch, ” I can’t be all sweetness and light, because I have no credibility.” I have to include a few things that I think CodingBat could do better. But I’ve got to tell you it was tough to come up with these. It’s a great tool and I think these negatives are all pretty trivial.

Cleaning up Classes

One of the good parts that I left out to keep this post from going on too long is that your students can share their submissions with you and you can go and look at their code.

But there doesn’t seem to be a way to group students. Not a big deal for small classes. I’ve had years though with 100 plus students using CodingBat and it’s tough to scroll through all of those. It would be nice to be able to group students into classes.

With that, it’s also tedious to remove students from your list at the end of the term. It may have improved since the last time I’ve done this, but last time I had to copy and paste each student’s email address and click a button to removed them individually. A “clear all students” button would be great.

… and …

Okay, so that’s really the only negative I could think of. Felt like I had to include at least one.

Codingbat Python List 2 Answers

In this series

As teaching moves beyond the classroom, there are dozens of online tools to use. Here are a few that I use teaching computer science.
CodingBat is a simple, but incredibly useful website for your students to practice coding.
You're probably already using YouTube in the classroom. What are you using it for?

Codingbat Python Solution

Get your students online and coding without installing an IDE or the JDK

Want to stay in touch and keep up to date with the latest posts @

Codingbat Python Has22

Related Posts