[Python] Drawing a hollow asterisk square

Discussão em 'Python' iniciado por Stack, Outubro 3, 2024.

  1. Stack

    Stack Membro Participativo

    I'm trying to figure out how to turn my whole square into a hollow one. The few things I've tried so far haven't been very successful as I end up getting presented with a rather distorted triangle!

    This is the code I have to form my square currently ..

    size = 5
    for i in range(size):
    print ('*' * size)


    When run, this is the result ..

    *****
    *****
    *****
    *****
    *****


    Do I need to run if or while statements when size is greater than 3 to specify a condition?

    Continue reading...

Compartilhe esta Página