Product code check digits programming challenges

These challenges provide students with the opportunity to exercise the ideas they have been working with around the checksums on product codes. Before assigning the challenges, you will need to check on which type of product code is common locally (particularly 12 or 13 digit), as the initial exercises are specific to the type of product code, to simplify the programming. 12-digit product codes, which are common in North America; 13-digit product codes are more common in Europe, Australia and New Zealand.

The challenges scaffold writing a program that does the basic checksum for a code, but students could enhance their program to put in extra checks, such as only digits (not letters) being typed in, and having the correct number of digits.

Number Name Challenge Level Languages
1.1 12 digit product codes: Weighted sum of digits (entered one at a time)
Growing experience
Learning outcomes

Students will be able to:

Challenge Solutions
Show Scratch solution
1.2 13 digit product codes: Weighted sum of digits (entered one at a time)
Growing experience
Learning outcomes

Students will be able to:

Challenge Solutions
Show Scratch solution
2.1 12 digit product codes: Check if total is a multiple of 10 (entered one at a time)
Growing experience
Learning outcomes

Students will be able to:

Challenge Solutions
Show Scratch solution
2.2 13 digit product codes: Check if total is a multiple of 10 (entered one at a time)
Growing experience
Learning outcomes

Students will be able to:

Challenge Solutions
Show Scratch solution
3.1 12 digit product codes: Check if total is a multiple of 10 (one line of input)
Growing experience
Learning outcomes

Students will be able to:

Challenge Solutions
Show Scratch solution
3.2 13 digit product codes: Check if total is a multiple of 10 (one line of input)
Growing experience
Learning outcomes

Students will be able to:

Challenge Solutions
Show Scratch solution
4.1 12 and 13 digit product codes: Check for a valid product code (any length)
Ready to expand
Learning outcomes

Students will be able to:

Challenge Solutions
Show Scratch solution
5.1 12 digit product codes: Calculate the last digit (entered one digit at a time)
Ready to expand
Learning outcomes

Students will be able to:

Challenge Solutions
Show Scratch solution
5.2 13 digit product codes: Calculate the last digit (entered one digit at a time)
Ready to expand
Learning outcomes

Students will be able to:

Challenge Solutions
Show Scratch solution
6.1 12 digit product codes: Calculate the last digit (one line of input)
Ready to expand
Learning outcomes

Students will be able to:

Challenge Solutions
Show Scratch solution
6.2 13 digit product codes: Calculate the last digit (one line of input)
Ready to expand
Learning outcomes

Students will be able to:

Challenge Solutions
Show Scratch solution