|
# 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 |
How would I write a Python Code for the three functions above? I am getting stuck after the first function. My current code is listed below. Thanks!

PLEASE NOTE : FEEL FREE TO ASK ANY DOUBTS by COMMENTING
Language : Python
IDE : Python IDLE
:::::::::::::::::::::::::::::::::::::::::::: CODE ::::::::::::::::::::::::::::::::::::::::
def horizontal_line(width):
print("Horizontal line, width=",width,":")
print("*"*width)
def vertical_line(shift, height):
print("Vertical Line, shift=",shift,";
height=",height,":")
# creating string for row, spaces for shift times and
"*" at end
row = " "*shift+"*"
# printing row for height times
for i in range(height):
print(row)
def two_vertical_lines(width,height):
print("Two Vertical Lines, width=",width,"; height=",height,":")
# creating string for row, starting with left "*"
and
# spaces for offset of width and "*" at end
row = "*"+" "*(width-2)+"*"
# printing row for height times
for i in range(height):
print(row)
# Testing code
horizontal_line(5)
vertical_line(5,5)
two_vertical_lines(5,5)
:::::::::::::::::::::::::::::::::::::::::::: OUTPUT ::::::::::::::::::::::::::::::::::::::::

:::::::::::::::::::::::::::::::::::::: CODE in EDITOR ::::::::::::::::::::::::::::::::::

_________________________________________________________________
Dear Friend, Feel Free to Ask Any Doubts by Commenting. ASAP i'll respond when i'm available.
I'm on a critical Situation. Please Do Not Forget To Give A Thumbs UP +1. It will Helps me A Lot.
Thank YOU :-)
# function: horizontal_line # input: a width value (integer) # processing: prints a single horizontal line...
python
Write a function that takes as input a single integer parametern and computes the nth Fibonacci Sequence number The Fibonacci sequence first two terms are 1 and 1(so, if n - 2 your function should return 1). From there, the previous two values are summed to come up with the next result in the sequence 1.1,2,3,5,8,13, 21, 34, 55, etc.) For example, if the input is 7 then your function should return 13 26561.1615880 1 def Fibonacci(n): # your...
Write a C program that accepts a single integer N. Your code must then calculate the average of all positive integers less than N that are divisible by either 5 or 7, but not both. When you print your average, truncate the result to three decimal places. Do not print anything else to the screen. Example input: 19 Example output: 10.200
C++ Write a function parseScores which takes a single input argument, a file name, as a string. Your function should read each line from the given filename, parse and process the data, and print the required information. Your function should return the number of student entries read from the file. Empty lines do not count as entries, and should be ignored. If the input file cannot be opened, return -1 and do not print anything. Your function should be named...
Write a function called printStars. The function receives a parameter containing an integer value. If the parameter is positive, the funciton prints (to standard output) the given number of asterisks. Otherwise the function does nothing. The function does not return a value. Thus, if printStars(8) is called, ******** (8 asterisks) will be printed. The function must not use a loop of any kind (for, while, do-while) to accomplish its job. Instead, it should examine its parameter, returning if the parameters...
Inspect the code below. The function subtract_five should take one integer as input and return that integer minus 5. Running the function will cause Python to throw an error. Change the function so the program correctly prints the value in y. This is the answer. but, see #. def subtract_five(inp): print(int(inp-5)) return(int(inp-5)) y = subtract_five(18) - 5 print("This is the value in y = ", y) # I don't understand this part? Why can I just use, print(y)??
python program Use the provided shift function to create a caesar cipher program. Your program should have a menu to offer the following options: Read a file as current message Save current message Type in a new message Display current message "Encrypt" message Change the shift value For more details, see the comments in the provided code. NO GLOBAL VARIABLES! Complete the program found in assignment.py. You may not change any provided code. You may only complete the sections labeled:#YOUR...
pick two answers
12 points). The function swap() should swap two integers and main() should print those two swapped integers. What (if anything is wrong with this code? Select all that apply. oooo. No ure W..Ni def main(): X = 10 y = 2 x, y = swap(x,y). print(x,y) def swap(a,b): a = b temp = a b = temp main N on line 9, it is illegal syntax to introduce a new variable named temp. Instead, temp should be...
Code in C++ please! Write a function that takes an array of integers as an input parameter (the address of the first value of the array). It returns nothing. It prints out the array as a single line, with commas between each number, and when the array is finished being printed, it prints an endl; so that we flush the buffer and move to a new line. (I’m having you write this function because you’ll be wanting to print out...
PYTHON:please display code in python
Part 1: Determining the Values for a Sine
Function
Write a Python program that displays and describes the equation
for plotting the sine function, then prompts the user for the
values A, B, C and D to be used in the calculation. Your program
should then compute and display the values for Amplitude, Range,
Frequency, Phase and Offset.
Example input/output for part 1:
Part 2: Displaying a Vertical Plot Header
A vertical plot of the...
Write a function draw_T in functions.py, which receives three
parameters: width, height and symbol. The first two parameters are
assumed to be integers and the third is a single character string.
You don’t need to validate the type of the given parameters. The
function returns no values. The function uses the given parameters
to draw a T shape, such that the parameter width controls the upper
bar, and height controls the middle vertical bar. The parameter
symbol, controls which symbol...