Question

Problem 5 (5 points) Given an integer number, n, create a n by n matrix that has values 0 to n- Use the built-in NumPy method

0 0
Add a comment Improve this question Transcribed image text
Answer #1

main.py ヨつ saved 1 import numpy as np 2 def np1 (n): 3 | #getting values from 0 to n^2-1 4. Python 3.6.1 (default, Dec 2015,

code:

import numpy as np

def np1(n):

#getting values from 0 to n^2-1

#and then changing shape of array to matrix with nxn dimensions

res = np.arange(n*n).reshape(n,n)

return res

print(np1(2))

print(np1(3))

Add a comment
Know the answer?
Add Answer to:
Problem 5 (5 points) Given an integer number, n, create a n by n matrix that...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT