in python:
Write a program that uses a two-dimensional list that has 4 rows, with 5 columns in each row. The program should do the following things
1. Create or fill in the list so that it has random numbers between 0 and 50.
2. Print the entire list using a loop.
from random import randint
matrix = []
for i in range(4):
tmp = []
for j in range(5):
tmp.append(randint(0, 50))
matrix.append(tmp)
for i in range(4):
print(matrix[i])
![[49, 39, 11, 37, 9] [4, 10, 32, 10, 20] 46, 49, 0, 17, 26] [4, 21, 28, 50, 38] Process finished with exit code O](http://img.homeworklib.com/questions/f0bd1810-c37f-11ea-84cf-51701398656e.png?x-oss-process=image/resize,w_560)
in python: Write a program that uses a two-dimensional list that has 4 rows, with 5...
In Python Write a program to fill a square list with 5 rows and 5 columns, placing the integer 1 along the diagonal. Print the list. Here is what the output should look like: 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1
Using Java. Write a program that creates a “triangular” two-dimensional array A of 10 rows. The first row has length 1, the second row has length 2, the third row has length 3, and so on. Then initialize the array using nested for loops so that the value of A[i][j] is i+j. Finally, print out the array in a nice triangular form.
Write a Java program to create a two-dimensional array, myFifthMatrix, with the following specifications: Initialize myFifthMatrix with int type and with size [3][3]. Use a for loop to fill the myFifthMatrix with random values between 0 and 99. Print the myFifthMatrix using a for loop. For each column, use a variable named total to store its sum. Add each element in the column to total using a for loop
Use C:
3. In function main, declare a two-dimensional integer array with 5 rows and 4 columns. Call the following functions from function main. Call a function createArray to seed the random number generator and to fill the two-dimensional array with random integers between -20 and +20. Parameters for this function should be the array and the number of rows and columns). Call a function signs to count the number of positive values, number of negative values and number of...
Write a C++ program using function that takes a Two Dimensional array, number of rows and number of columns in that array as argument, and returns another 2D-array containing binary representation of those numbers.
Write a piece of code that constructs a two-dimensional array of integers with 5 rows and 10 columns. Fill the array with a multiplication table, so that array element [i][j] contains the value i * j. Use nested for loops to build the array. java Program
Write a java program that create a 2 dimensional array of type double of size 10 by 10. Fill the array with random numbers using a random number generator. Print the array contents. Write a java program that creates a file called data.txt that uses the PrintWriter class. Write the numbers 1 to 42 into the file. Close the file. Attach both files. Thank you in advance
Write a Python program that generate randomly a magic square of 3 x 3 elements. For example: 4 3 8 9 5 1 2 7 6 = Matrix1 Matrix 1 above is an example of magic square. The rows total, the columns total, and the diagonal totals are all 15. Your program should randomly generate a 3x3 matrix. Check if it is a magic square. If it is a magic square, then print some information and quit. If the...
Write a python program that uses a while loop to print numbers 100,98,96... all the way to 0. each number should be printed on a seperate line
Create a program that uses a Jagged Array. The program will create an array with 50 rows. Each of the values for each element of the array will be randomly generated. The random values will be between 1 and 20. Depending on the value generated for each row, you will create an array with that number of columns for that row. Each column created will contain the value to the left plus 1. After you create and populate the entire...