Lab # 5
EXPLANATION: In this lab will explain how to save characters into a function and after that invoke in the interpreter mode.
1.- Open python IDLE.
2.- Insert the next code as you can see there are definitions and functions in this case is laser beam.
3.- Running the program.
4.-The fist grid of each line (type the next code)
5.- Running the program.
6.-print in row
7.- Run the program
8.-The whole program.
9.- the code
SOURCE CODE:
def print_beam():
“””This function prints a beam”””
print (“+ – – – -“),
def print_post():
“””This function prints a post”””
print(“| “),
def print_beams():
“””This function printthe beams of a grid”””
print (“+ – – – -“, “+ – – – -“, “+”)
def print_posts():
“””This function print the posts of a line”””
print (“| “, “| “, “|”)
def print_row():
“””This function print in a row of a grid”””
print (“+ – – – -“, “+ – – – -“, “+”)
print (“| “, “| “, “|”)
print (“| “, “| “, “|”)
print (“| “, “| “, “|”)
print (“| “, “| “, “|”)
def print_grid():
print_row(),
print_row(),
print_beams(),