Exercise 5. (Transpose) Write a program called transpose.py that accepts m (int) and n (int) as command-line arguments,

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Exercise 5. (Transpose) Write a program called transpose.py that accepts m (int) and n (int) as command-line arguments,

Post by answerhappygod »

Exercise 5 Transpose Write A Program Called Transpose Py That Accepts M Int And N Int As Command Line Arguments 1
Exercise 5 Transpose Write A Program Called Transpose Py That Accepts M Int And N Int As Command Line Arguments 1 (50.03 KiB) Viewed 41 times
Exercise 5 Transpose Write A Program Called Transpose Py That Accepts M Int And N Int As Command Line Arguments 2
Exercise 5 Transpose Write A Program Called Transpose Py That Accepts M Int And N Int As Command Line Arguments 2 (164.05 KiB) Viewed 41 times
Exercise 5 Transpose Write A Program Called Transpose Py That Accepts M Int And N Int As Command Line Arguments 3
Exercise 5 Transpose Write A Program Called Transpose Py That Accepts M Int And N Int As Command Line Arguments 3 (199.65 KiB) Viewed 41 times
Exercise 5 Transpose Write A Program Called Transpose Py That Accepts M Int And N Int As Command Line Arguments 4
Exercise 5 Transpose Write A Program Called Transpose Py That Accepts M Int And N Int As Command Line Arguments 4 (168.53 KiB) Viewed 41 times
please explain In detail what I am doing wrong as well as modifiy my code so it will work. please use the exact structure and comments I used as they are standard for the problem. thank you.
Exercise 5. (Transpose) Write a program called transpose.py that accepts m (int) and n (int) as command-line arguments, mxn floats from standard input representing the elements of an mxn matrix a, and writes to standard output the transpose of a. >/workspace/project3 $ python3 transpose py 2 2 1234 <enter> 1.0 3.0 $ python3 transpose py 2 3 123456 <enter> 1.0 4.0 2.0 5.0
mport stdarray mport stdio Import sys #Accept m (int) and n (int) as command-Line arguments. n = int(sys.argv[1]) = int(sys.argv[2]) #Accept m x n floats from standard input and store then in a 20 list a. a = stdarray.create20(m, n, None) for i in range(n): for j in range(n): | a[j] = (stdio.readFloat()) print(a) # Set c (the transpose offa) to a 2D List with a rows and m columns, with all the elements # initialized to 8.8 c= stdarray.create2D(n, n, 0.0) #Fill in the elements of c such that c[j] = a[j][1], where 0 <=i<n and @ <= j <a. for i in range(a): 3 for j in range(n): if 0 <=i<n and <=j< m: c[j] = a[j][1] #Write c to standard output. for i in range(n): TO for 1 in range(n):
print(a) # Set e (the transpose of a) to a 20 list with n rows and a cetumns, with all the elements A# initialized to 8.0 ce stdarray.create20(m, n, e Fill in the elements of c such that c[j] = a[j][1], where @ for à in range(n): for in range(n): ifeien and e[j] = a[j][1] # Write c to standard output. for i in range(n): for j in range(n): I ifjl= n - 1: # If j is not the last column, write o[1][1] with a space after. stdio.write(fie[1][j]}') enspoes.gr/ #Otherwise, write the element with a newline after.. stdio.writeln(e[1][j])
/Users/Bootygoblin/Downloads/cs118_programming exami 1.0 2.0 3.0 4.0 5.0 6.0 [[1.8, 2.0], [3.0, 4.0], [5.0, 6.0]] 1.0 3.0 2.0 4.0 8.8 8.8 Process finished with exit code 6 1
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply