Problem whit end=""

def figur1():
    for i in range(1, 5):
        print((4 - i) * " " + "*" * i + "*" * i + (4 - i) * " ")
    for i1 in range(1, 4):
        print(i1 * " " + (4 - i1) * "*" + (4 - i1) * "*")


size_length = int(input("Write a length "))
for i2 in range(1, size_length + 1):
    print(figur1(), end=" ")

Why the figurs do not print in the same line?

Within figur1() you called print() twice, but you did not pass end=" " to those print() functions.

Why would the figures print on the same line? When you print the
figures, you print them with these two commands:

print((4 - i) * " " + "*" * i + "*" * i + (4 - i) * " ")

print(i1 * " " + (4 - i1) * "*" + (4 - i1) * "*")

which uses the default settings, which is to print a newline after each
item.

You have:

print(figur1(), end=" ")

So follow what happens: first, Python runs the function figur1. That
prints some stuff, newlines and all. Then figur1() returns None. Then
you print(None, end=" ").

By the way, “figur” is misspelled, it should have an E at the end:
“figure1” not “figur1”.

Also, you’re allowed to re-use variables. You don’t have to use a
different, numbered, i in each of your for-loops. You can if you wish,
but most people just use i rather than i, i1, i2, …

Or you can use i, j, k as loop variables. Just don’t use l because that
is too easy to misread as 1.

1 Like

Thank you for help gays!