vendredi 23 avril 2021

problem with printing stars in 'S' pattern

I have some problems with my code...

I want to get this pattern: Sshape but with my code I'm getting this one:

ooooooooooooooooo
ooooooooooooooooo
ooooooooooooooooo
oooo
oooo
oooo
ooooooooooooooooo
ooooooooooooooooo
ooooooooooooooooo
oooo
oooo
oooo
ooooooooooooooooo
ooooooooooooooooo
ooooooooooooooooo

I can't figure it out by myself...

    for col in range(17):
        if row == 0 or (row>0 and row<3):
            print("o", end='')
        elif row>5 and row<=8:
            print("o", end='')
        elif row == 14 or (row > 11 and row < 14):
            print("o", end='')
        elif ((row ==3 or row ==4 or row ==5) and col<4):
            print("o", end='')
        elif ((row ==9 or row ==10 or row ==11) and col>=13):
            print("o", end='')

    else:
        print(" ", end=" ")


    print()

Aucun commentaire:

Enregistrer un commentaire