Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Near_ten
#2
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).
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Messages In This Thread
Near_ten - by Dixon - Dec-15-2019, 11:06 PM
RE: Near_ten - by ichabod801 - Dec-15-2019, 11:42 PM
RE: Near_ten - by Dixon - Dec-16-2019, 05:51 PM
RE: Near_ten - by ichabod801 - Dec-16-2019, 07:17 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020