Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
Any sequence of units (typically letters or numbers) that are read the same way forward or backward.
4
votes
Circles of numbers
So the code could be:
def dist(P1, P2):
x1, y1 = P1
x2, y2 = P2
return max(abs(x2-x1), abs(y2-y1))
def palindrome(n, center=(0,0)):
assert n <= 9
return '\n'.join(
''.join … str(dist((x, y), center))
for x in range(-n, n+1)
)
for y in range(-n, n+1)
)
This reproduces your code, but if you change the center you can do nice things such as palindrome …