Solving ChatGPT Prompt NumPy Exercise

in StemSocial5 months ago

image.png


Image Source

Most people claim ChatGPT is a bad thing to use as it hinders your memory performance. I agree with this one as it can hinder your learning if you always use it for cheating, relies fully on it, contributing no effort from your side. Relying fully on ChatGPT is also not recommended as it generates inaccurate information most of the time.

It has both negative and positive aspects. You can learn a many things if you use it rationally. You should also know cheat codes for the prompts. So in this post, I am asking ChatGPT to give me one exercise in NumPy and we will try to solve it on our own.

Prompts: Give me one exercise to do myself regarding NumPy. Don't include the code. I will try to solve on my own.

image.png

Now lets try to solve the problems.

import numpy as np

# Creating a 5*5 array using random function to fill the array with random integer
array_1 = np.random.randint(1,100,(5,5))

#Checking the dimension of the array
array_1.shape

# Printing the array
array_1

# Finding the mean
array_1.mean()

# Finding the standard deviation
array_1.std()

# Finding the sum of all values in the array
array_1.sum()

# Finding the maximum value
array_1.max()

# Finding the minimum value
array_1.min()

# Sum across column
array_1.sum(axis=0)

#Sum across row
array_1.sum(axis=1)

If you run the above code, you can get the following output:

image.png

image.png

Sort:  

Thanks for your contribution to the STEMsocial community. Feel free to join us on discord to get to know the rest of us!

Please consider delegating to the @stemsocial account (85% of the curation rewards are returned).

Thanks for including @stemsocial as a beneficiary, which gives you stronger support. 
 

khatra padhai bhaeracha ta bro.

Haha bro
Kaam le khasai ghumna jana paidaina
Na payesi content hudaina
Alxi lagxa padhna ni🤣