practice code from beginner book