A printable PDF is available.

# In-Class Practice Problems

On September 19, we will spend the lecture time solving as many BYOB programming problems as we can. This is a list of problems that we'll start going through. Any that we don't get to in class would be good practice problems to think about on your own!

### Some simple math reporter blocks:

1. Make a reporter block that reports the average of two input parameters.

2. Make a reporter block that reports the absolute value of its input parameter.

3. Make a reporter block that reports an estimate of the square root of its input parameter.

### Some problems with predicates:

1. Make a predicate block that reports whether the parameter is even.

2. Make a predicate block that reports whether the parameter is a prime number.

### Some problems with stamping and positioning:

1. Write a script that stamps out some number of sprites, horizontally centered around the current location.

2. Turn the solution to #1 into a command block that uses a parameter for the number of copies.

### Some problems with strings:

1. Make a reporter block that takes a string as a parameter and reverses the characters in the string.

2. Make a reporter block that takes a string as a parameter (ideally just containing lower-case letters) and returns the "Caesar cipher" encoding of that string, where all letters are shifted by three positions ('a' becomes 'd', 'b' becomes 'e', etc.)

### Building on these problems:

1. Make a reporter block that estimates the distance between two points given in (x,y) coordinates, using your square root block from #2.

2. After stamping out the centered group of sprites, have the sprite say what the x coordinates of the stamp locations were - all locations in a single "say" block.

3. Make a reporter block that takes a string, start position, and length as parameters, and reports the indicated substring.