Quick actions

cmd+k|ctrl+k

Navigation

Languages

0718PythonFunction

Snippet info

Language

Python

Visibility

public

Author

mhcrnl

Created

2018-09-28T03:00:02Z

Updated

2018-09-28T03:00:02Z

print("Functions")



def header():
    print("A Function")



#header()





def line(width):
    print('*' * int(width))

def border(count, width):
    for line in range(count):
        print('*', ' ' * int(width), '*')

line(19)
border(7, 15)
line(19)






# Ideal sizes
# 40 x 14
# 19 x 7
# 10 x 4
#  5 x 1
# line(40)
# border(14, 36)
# line(40)





def box(size):
    if size <= 1:
        size = 1
        width = 4
    else:
        width = size * 2.5 + 1 # derived by experimentation
    print('\nSize', size)
    line(width)
    border(size, width - 4) # start, end and two spaces for comma's
    line(width)

   
    
box(1)
box(2)
box(3)
box(10)
box(20)





for size in range(1, 30):
    box(size)
INFO