#WEAVING A RUG WITH PYTHON

####################################################################################




## END STRINGS## 

for rows in range(1):
    for cols in range(36):
        print('~', end='')
    print('\n')

    
## SEAM ##
    
for rows in range(1):
    for cols in range(12):
        print('- -', end='')
    print()


## DUAL ROW DESIGN ##

for rows in range(2):
    for cols in range(36):
        print('*', end='')
    print()




## CHECKERBOARD ##
##    DESIGN    ##

for rows in range(3):
    for lines in range(6):
        for cols in range(3):
            print('*', end= '')
        for cols in range(3):
            print(' ', end='')
    print()
    for lines in range(6):
        for cols in range(3):
            print(' ', end='')
        for cols in range(3):
            print('*', end='')
    print()




## DIAMOND ##
##  DESIGN ##

for rows in range(1):
    for cols in range(16):
        print(' ', end='')
    for cols in range(1):
        print('*', end='')
    print()
    for cols in range(15):
        print(' ', end='')
    for cols in range(3):
        print('*', end='')
    print()
    for cols in range(14):
        print(' ', end='')
    for cols in range(5):
        print('*', end='')
    print()
    for cols in range(13):
        print(' ', end='')
    for cols in range(7):
        print('*', end='')
    print()
    for cols in range(12):
        print(' ', end='')
    for cols in range(9):
        print('*', end='')
    print()


#


for rows in range(1):
    for cols in range(13):
        print(' ', end='')
    for cols in range(7):
        print('*', end='')
    print()
    for cols in range(14):
        print(' ', end='')
    for cols in range(5):
        print('*', end='')
    print()
    for cols in range(15):
        print(' ', end='')
    for cols in range(3):
        print('*', end='')
    print()
    for cols in range(16):
        print(' ', end='')
    for cols in range(1):
        print('*', end='')
    print()




## CHECKERBOARD ##
##    DESIGN 2  ## 

for rows in range(3):
    for lines in range(6):
        for cols in range(3):
            print('*', end='')
        for cols in range(3):
            print(' ', end='')
    print()
    for lines in range(6):
        for cols in range(3):
            print(' ', end='')
        for cols in range(3):
            print('*', end='')
    print()




## DUAL ROW DESGIN ##

for rows in range(2):
    for cols in range(36):
        print('*', end='')
    print()


## SEAM ##

for rows in range(1):
    for cols in range(12):
        print('- -', end='')
    print()

    
## END STRINGS ##

print('\n')
for rows in range(1):
    for cols in range(36):
        print('~', end='')

This is an assignment I had to complete recently in which I had to "sew" a rug with only loops & nested loops - NOTHING ELSE - NO conditions (if/elif/else) -

It sure was fun, and, for all intents and purposes it is done. If you run this it should come out the nice pattern my professor assigned to us..


But, for kicks and giggles, I want to run a Line (lowercase L's) down the sides of the pattern, connecting to the top and bottom Seams - like so:

- -- -- -- -- -- -- -- -- -- -- -- -
l
l
l
l
l
l


Any idea as to how I may proceed with this little idea --> incorporating the Side Lines into the code?


Thanks!

This article has been dead for over six months. Start a new discussion instead.