Skip to content

Categories:

Lab4

In this lab i was asked to write a program that draws a grid using different functions. The grid is composed only of three characters ‘+’,’-’, and ‘|’.

First i followed the instructions and copied the code :

def print_beam():

“””This function prints a beam”””
print ‘+ – – – -’,

and i kept following the steps and instruction until the grid came out.

Source code:

def print_beam():
print ‘+ – – – -‘,”+ – – – – +”

def print_post():
print ‘|        ‘,”|         |”

def repeat_post():
print_post()
print_post()
print_post()
print_post()

print_beam()
repeat_post()
print_beam()
repeat_post()
print_beam()