Write a Python program that tests the function main and the functions discussed in parts a through g.
Create the following lists:
inStock - 2D list (row size:10, column
size:4)
alpha - 1D list with 20 elements.
beta - 1D list with 20 elements.
gamma = [11, 13, 15, 17]
delta = [3, 5, 2, 6, 10, 9, 7, 11, 1, 8]
a. Write the definition of the function setZero that initializes any one-dimensional list to 0 (alpha and beta).
b. Write the definition of the function inputArray that prompts the user to input 20 numbers and stores the numbers into alpha.
c. Write the definition of the function doubleArray that initializes the elements of beta to two times the corresponding elements in alpha.
d. Write the definition of the function copyGamma that sets the elements of the first row of inStock from gamma and the remaining rows of inStock to three times the previous row of inStock.
e. Write the definition of the function copyAlphaBeta that stores alpha into the first five rows of inStock and betainto the last five rows of inStock.
f. Write the definition of the function printArray that prints any one-dimensional list. The function must contain only one loop to print any one-dimensional list.
g. Write the definition of the function
setInStock that prompts the user to input the
elements for the first column of inStock. The
function should then set the elements in the remaining columns to
two times the
corresponding element in the previous column, minus the
corresponding element in delta.



################### PGM START ######################################
def setZero(a):
a=[0]*20
print(a)
def doubleArray(b,a):
for i in range(0,len(a)):
b[i]=2*a[i]
def copyGamma(iS,g):
iS[0]=g
for i in range(1,10):
for j in
range(0,4):
iS[i][j]=iS[i-1][j]*3
def copyAlphaBeta(iS,a,b):
k=0
for i in range(0,5):
for j in
range(0,4):
iS[i][j]=a[k]
k+=1
k=0
for i in range(5,10):
for j in
range(0,4):
iS[i][j]=b[k]
k+=1
def printArray(a):
for i in range(0,len(a)):
print(i)
def setInStock(iS,d):
for i in range(0,10):
for j in
range(1,4):
iS[i][j]=(2*iS[i][j-1])-d[i]
#main method
if __name__=="__main__":
alpha=[0]*20
beta=[0]*20
gamma=[11,13,15,17]
delta = [3, 5, 2, 6, 10, 9, 7, 11, 1, 8]
inStock=[]
for i in range(10):
inStock.append([0] *
4)
print("Alpha after initialization")
setZero(alpha)
print("Enter 20 integers:")
for i in range(0,20):
alpha[i]=int(input())
print("Alpha after reading 20 numbers")
print(alpha)
print("Beta after a call to doubleArray")
doubleArray(beta,alpha)
print(beta)
print("instock after a call to copyGamma")
copyGamma(inStock,gamma)
print(inStock)
copyAlphaBeta(inStock,alpha,beta)
print("instock after a call to
copyAlphaBeta")
print(inStock)
print("\nEnter 10 integers")
for i in range(0,10):
inStock[i][0]=int(input())
print("inStock after a call to
setInstock")
setInStock(inStock,delta)
print(inStock)
###################### PGM END #########################################
OUTPUT
###########
![Alpha after initialization [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] Enter 20 integers:](http://img.homeworklib.com/questions/c71d1060-86ca-11ec-860c-4535e13b80aa.png?x-oss-process=image/resize,w_560)
![Alpha after reading 20 numbers [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20] Beta after a call to d](http://img.homeworklib.com/questions/c78d0270-86ca-11ec-9738-c169930ec572.png?x-oss-process=image/resize,w_560)
![Enter 10 integers inStock after a call to setInstock [[21, 39, 75, 147], [22, 39, 73, 141], [23, 44, 86, 170], [24, 42, 78, 1](http://img.homeworklib.com/questions/c82ec4a0-86ca-11ec-a9a7-879ddb262d55.png?x-oss-process=image/resize,w_560)
Write a Python program that tests the function main and the functions discussed in parts a...
Assembly Language Programming Assignment program must be in: MASM assembly language / x86 architecture / irvine library procedures Objectives: 1. using register indirect addressing 2. passing parameters 3. generating “random” numbers 4. working with arrays Description: Write and test a MASM program to perform the following tasks: 1. Introduce the program. 2. Generate ARRAYSIZE random integers in the range [LO = 10 .. HI = 29], storing them in consecutive elements of an array. ARRAYSIZE should be set to 200....
Refer to the following array definition for questions 1 & 2 int numberArray[9)[11] 1. Write a statement that assigns 145 to the first column of the first row of this array. 2. Write a statement that assigns 18 to the last column of the last row of this array. values is a two-dimensional array of floats, with 10 rows and 20 columns. Write code that sums all of the elements in the array and stores the sum in the variable...
2. A=[17 18 12 15 20 22 25 26 28 29 30 21] and B=[11 20 25 28 29 13 14 25 22 33 10 23] Write a MATLAB code which will show which elements of A are more than B and their indices.
You have this solution in Java, I am interested in this same solution for Python.One interesting application of two-dimensional arrays is magic squares. A magic square is a square matrix in which the sum of every row, every column, and bothdiagonals is the same. Magic squares have been studied for many years, and there are some particularly famous magic squares. In this exercise you will write code todetermine whether a square is magic.You should find that the first, second, and...
Task 2 Write a shell script program call cal3.sh to do the following. 1. Print the output "you must provide at least one month" when there is no argument 2. Print the calendar with specified month matching the argument when there is one argument $ ./cal3.sh 1 January 2016 Su Mo Tu We Th Fr Sa 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 24 25 26 27...
Write a program that, given a month and year, prints a calendar, such as June 2016 Su Mo Tu We Th Fr Sa 5 6 7 8 910 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 To find out the weekday of the first day of the month, call this function: Computes the weekday of a given date. @param year the year @param month the month (1=January 12=...
Given the following 2D array double nums[MAXROW][MAXCOL] = {{ 7, 12, 8, 23, 43, 16, 9, 15}, {21, 7, 14, 48, 13, 6, 43, 29), {11, 2, 17, 91, 36, 14, 65, 43), {18, 5, 47, 38,52, 1, 18, 26}}; int numRows = 4; int numCols = 8; Write a function called totalRow that has the array, the number of rows, and the number of columns passed in. It will then print the total of the row that has 11,...
Exercise 6: Program exercise for 2D List Write a complete Python program including minimal comments (file name, your name, and problem description) that solves the following problem with the main function: Problem Specification: The following code reads values from the file object infile and stores them in the 2d list table2: (It assumes that each line contains values of elements in each row and the values are whitespace separated.) table2 = [] for line in infile: row=line.split() intRow = []...
R$ ( pseudocode only, I just need the English written pseudocode) Write pseudocode for a program that prints a calendar such as the following: Su M T W Th F Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
PYTHON PROGRAMMING: DO NOT USE INPUT FUNCTION, use sys.argv Write a program that generates two random integer numbers between 1 and 100. Then, print out the numbers between the two randomly generated ones using a while loop. The output is shown below. Output: a) start:4, end:14 4 5 6 7 8 9 10 11 12 13 14 b) start:15, end:20 15 16 17 18 19 20