7 gives me 1.

0077 gives me 2.

770 returns nothing.

It seems when the 7 is not on the right hand side of the integer it doesn't count it correctly.

Now let's consider why... What is the condition in which the body of the loop will be executed?

It reads like: while the remainder of number divided by ten is seven.

That is really not what you want to do. What you want to do is check the whole number, every digit, regardless of whether the right most digit is a 7 or not.

So the loop could read like: while number is greater than ten { do my work to check the right most digit and update my number }

or: for each digit in the given number { do my work to check the right most digit }

I would recommend you start with writing down a series of steps to take to solve the problem, and then write code to perform the steps.