# Lp-norm.
def pdist(x1, y1, x2, y2, p):
dx = abs(x2 - x1)
dy = abs(y2 - y1)
return pow(dx ** p + dy ** p, 1 / p)
def pcircle(r, p):
print(f"p={p}")
for y in range(-r, r+1, 2):
for x in range(-r, r+1):
print('*' if round(pdist(0, 0, x, y, p)) <= r else ' ', end='')
print()
pcircle(12, 3/4)
pcircle(12, 1)
pcircle(12, 2)
pcircle(12, 4)
IyBMcC1ub3JtLgoKZGVmIHBkaXN0KHgxLCB5MSwgeDIsIHkyLCBwKToKICAgIGR4ID0gYWJzKHgyIC0geDEpCiAgICBkeSA9IGFicyh5MiAtIHkxKQogICAgcmV0dXJuIHBvdyhkeCAqKiBwICsgZHkgKiogcCwgMSAvIHApCgpkZWYgcGNpcmNsZShyLCBwKToKICAgIHByaW50KGYicD17cH0iKQogICAgZm9yIHkgaW4gcmFuZ2UoLXIsIHIrMSwgMik6CiAgICAgICAgZm9yIHggaW4gcmFuZ2UoLXIsIHIrMSk6CiAgICAgICAgICAgIHByaW50KCcqJyBpZiByb3VuZChwZGlzdCgwLCAwLCB4LCB5LCBwKSkgPD0gciBlbHNlICcgJywgZW5kPScnKQogICAgICAgIHByaW50KCkKCnBjaXJjbGUoMTIsIDMvNCkKcGNpcmNsZSgxMiwgMSkKcGNpcmNsZSgxMiwgMikKcGNpcmNsZSgxMiwgNCk=