Solve the following problem with Python IDLE. The goal is to generate digital number signs. For simplicity, you will use only the numerals 0, 1, and 2, and the signs will be vertical. You will develop a collection of functions that can be used to draw numerals in the format commonly used to digital clocks and other displays. You will build the functions in a systematic way, writing a series of steps that build on one another, so it's important to progress through this assignment in order. Use the indicated function names. # function: horizontal_line # input: a width value (integer) # processing: prints a single horizontal line of the desired size # output: does not return anything # function: vertical_line # input: a shift value and a height value (both integers) # processing: generates a single vertical line of the desired height. the line # is offset from the left side of the screen using the shift value # output: does not return anything # function: two_vertical_lines # input: a width value and a height value (both integers) # processing: generates two vertical lines. the first line is along the left side of # the screen. the second line is offset using the "width" value supplied # output: does not return anything Test to be sure these functions are working correctly before continuing to the next step. Be sure to try a variety of arguments. Try the following calls (Code them into the program and them delete the lines when you are finished testing): horizontal_line(5) horizontal_line(15) vertical_line(0, 3) vertical_line(6, 5) two_vertical_lines(4, 5) two_vertical_lines(5, 2) Here’s what some of them will look like Horizontal line with width = 5: ***** Vertical Line, shift=2; height=3: (shifted 2 spaces over from the left) * * * Two Vertical Lines, height=4; width=5: * * * * * * * *
Solve the following problem with Python IDLE. The goal is to generate digital number signs. For simplicity, you will use only the numerals 0, 1, and 2, and the signs will be vertical. You will develop a collection of functions that can be used to draw numerals in the format commonly used to digital clocks and other displays. You will build the functions in a systematic way, writing a series of steps that build on one another, so it's important to progress through this assignment in order. Use the indicated function names.
# function: horizontal_line
# input: a width value (integer)
# processing: prints a single horizontal line of the desired size
# output: does not return anything
# function: vertical_line
# input: a shift value and a height value (both integers)
# processing: generates a single vertical line of the desired height. the line
# is offset from the left side of the screen using the shift value
# output: does not return anything
# function: two_vertical_lines
# input: a width value and a height value (both integers)
# processing: generates two vertical lines. the first line is along the left side of
# the screen. the second line is offset using the "width" value supplied
# output: does not return anything
Test to be sure these functions are working correctly before continuing to the next step. Be
sure to try a variety of arguments. Try the following calls (Code them into the program and
them delete the lines when you are finished testing):
horizontal_line(5) horizontal_line(15)
vertical_line(0, 3) vertical_line(6, 5)
two_vertical_lines(4, 5) two_vertical_lines(5, 2)
Here’s what some of them will look like
Horizontal line with width = 5:
*****
Vertical Line, shift=2; height=3: (shifted 2 spaces over from the left)
*
*
*
Two Vertical Lines, height=4; width=5:
* *
* *
* *
* *
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images