I have following code, which should print an output of k numbers around n number, and instead the n number the code should replace by *:
def numbers_around(n, k):
for cislo in range(n-k, n+k+1):
if cislo == n:
print("*", end=" ")
else:
print(cislo, end=" ")
numbers_around(8, 3)
numbers_around(10, 2)
The output should be:
5 6 7 * 9 10 11
8 9 * 11 12
But my output is all in one line:
5 6 7 * 9 10 11 8 9 * 11 12