Dec-15-2019, 11:42 PM
You are going to have to be more specific. I don't know what solutions you are talking about. Post the code you are having a problem understanding.
The list you give is all the numbers within two of the provided number. If any of those are a multiple of 10, then you would return True, otherwise you would return False (assuming you are talking about this problem). You could test each one with a for loop, which is what it sounds like is going on.
Another approach would just be to check num % 10. If num is within two of a power of ten, we know that num % 10 must be one of (0, 1, 2, 8, 9).
The list you give is all the numbers within two of the provided number. If any of those are a multiple of 10, then you would return True, otherwise you would return False (assuming you are talking about this problem). You could test each one with a for loop, which is what it sounds like is going on.
Another approach would just be to check num % 10. If num is within two of a power of ten, we know that num % 10 must be one of (0, 1, 2, 8, 9).
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures