This question may be a little challenging if your math skills are rusty. Don't be afraid to take advantage of the hints. Try your best to solve the problem, but don't feel compelled to complete it if you become frustrated.
Use the REPL and the arithmetic operators to extract the individual digits of 4936:
- One place is
6. - Tens place is
3. - Hundreds place is
9. - Thousands place is
4.
Each digit may require multiple Python statements.
It's easier to extract the digits right-to-left rather than left-to-right.
number % 10 returns the rightmost digit of a number. You can use this repeatedly to extract all of the digits.
Once you have the rightmost digit, how do you remove that digit from the number? If we start with 4936 and extract the 6, how do we now reduce our number to 493?
You can remove the rightmost digit by using integer division.