Hi everyone, I really need help with my Python homework. There are two codes which I have try to finish this weekend all day long, but none of them work.
These three photos are problème #1.
These two photos are problem #2
Sample input 2 2 -7 8 5 ao Sample output 2 -0.46 -6.61 1.24 -0.47 -0.69 -2.04 -3.93 2.29 -2.51 -3.00 2.32 0.94 -4.98 0.70 -4.23 4.78 5.81 0.41 5.70 -5.81 0.58 -6.02 -0.58 -5.55 -5.09
Description Please write a program to generate random number matrix with a lower bound and an upper bound of real numbers and size specified by the user. Input given by testing samples contains five integers. The first is the seed for the random number generation. The second and third are the lower and upper bound for the random number. lower < random number upper The fourth and fifth are the row and column size of your random number matrix you are to generate. Input random number seed lower bound upper bound the number of rows of the matrix the number of columns of the matrix Output A matrix of random numbers Print the numpy array using provided printArray function Sample input 1 1 AWOWO- 5 3 Sample output 1 2.09 3.60 0.00 1.51 0.73 0.46 0.93 1.73 1.98 2.69 2.10 3.43 Sample input 2 2. -7 8 5 5
Reading Input (given) The following lines of code will help you read in the input integers In (1): import numpy as np In [2]: # uncomment the following lines to read the inputs # seed = int(input()) # Lower = int(input()) # upper = int(input()) #r int(input()) # c = int(input()) # np.random. seed(seed) In [3]: seed = 1 lower = 0 upper = 5 n = 3 C = 4 np.random. seed(seed) Print Function (given) Please print the output using given function. In [4]: def TaPrint(Student_Array): 11 Please use this function to print the output :param Student_Array: the numpy array created by yourself for row in range (Student_Array. shape [0]): for col in range(Student_Array, shape (1]): print(f"{Student_Array (row] (col):<6.2f}", end="") print("")
Description Please write a program to generate an array of random integers. The input consists of four integers. The first is the seed for the random number generation. The second and third are the lower and upper bounds for the random number lower random number < upper The fourth is how many numbers you are to generate. Input random number seed lower bound upper bound amount of number to generate Output A row of random numbers Sample input 1 1 0 5 20 Sample output 1 [3 401300 1 4 4 1 2 4 2 4 3 4 2 4 2] Sample input 2 2 10 50 4 Sample output 2 [25 18 32 28)
Sample input 3 99 22 77 10 Sample output 3 [23 57 62 31 62 40 26 27 74 23] Reading Input (given) The following lines of code will help you read in the input integers In [ ]: import numpy as np In [ ]: # seed = int(input) # lower = int(input()) # upper = int(input) # amount = int(input()) # np.random. seed(seed) In [ ]: seed = 1 lower = upper = 5 amount = 20
Hi everyone, I really need help with my Python homework. There are two codes which I have try to finish this weekend all
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
Hi everyone, I really need help with my Python homework. There are two codes which I have try to finish this weekend all
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!