diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..0e40fe8
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,3 @@
+
+# Default ignored files
+/workspace.xml
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml
new file mode 100644
index 0000000..105ce2d
--- /dev/null
+++ b/.idea/inspectionProfiles/profiles_settings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/lab-numpy.iml b/.idea/lab-numpy.iml
new file mode 100644
index 0000000..7c9d48f
--- /dev/null
+++ b/.idea/lab-numpy.iml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..a2e120d
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..120609b
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..94a25f7
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/your-code/main.py b/your-code/main.py
index 78c792b..a04aa35 100644
--- a/your-code/main.py
+++ b/your-code/main.py
@@ -1,72 +1,89 @@
-#1. Import the NUMPY package under the name np.
+# 1.- Import the NUMPY package under the name np.
+import numpy
+# 2. Print the NUMPY version and the configuration.
+numpy_version = numpy.version
+print("Version:", numpy_version.version)
-#2. Print the NUMPY version and the configuration.
-
-
-#3. Generate a 2x3x5 3-dimensional array with random values. Assign the array to variable "a"
+# 3. Generate a 2x3x5 3-dimensional array with random values. Assign the array to variable "a"
# Challenge: there are at least three easy ways that use numpy to generate random arrays. How many ways can you find?
+a = numpy.random.random((2, 3, 5))
+# 4. Print a.
+print("a: ", a)
-#4. Print a.
-
-
-
-#5. Create a 5x2x3 3-dimensional array with all values equaling 1.
-#Assign the array to variable "b"
-
-
-
-#6. Print b.
-
-
-
-#7. Do a and b have the same size? How do you prove that in Python code?
+# 5. Create a 5x2x3 3-dimensional array with all values equaling 1.
+# Assign the array to variable "b"
+b = numpy.ones((5, 3, 2))
+# 6. Print b.
+print("b:", b)
-#8. Are you able to add a and b? Why or why not?
+# 7. Do a and b have the same size? How do you prove that in Python code?
+print("Same Size A and B?", len(a) == len(b))
-#9. Transpose b so that it has the same structure of a (i.e. become a 2x3x5 array). Assign the transposed array to varialbe "c".
+# 8. Are you able to add a and b? Why or why not?
+try:
+ numpy.add(a, b)
+except:
+ print("No son del mismo tamaño")
-#10. Try to add a and c. Now it should work. Assign the sum to varialbe "d". But why does it work now?
+# 9. Transpose b so that it has the same structure of a (i.e. become a 2x3x5 array). Assign the transposed array
+# to variable "c".
+c = numpy.transpose(b)
+print("c:", c)
+# 10. Try to add a and c. Now it should work. Assign the sum to varialbe "d". But why does it work now?
+try:
+ d = numpy.add(a, c)
+except:
+ print("operands could not be broadcast together with shapes/ No son del mismo tamaño")
-#11. Print a and d. Notice the difference and relation of the two array in terms of the values? Explain.
+print("a-shape: ", a.shape, "c-shape", c.shape)
+# 11. Print a and d. Notice the difference and relation of the two array in terms of the values? Explain.
+print("a: ", a)
+print("d: ", d)
+# Numpy realizó una suma entre arreglos, sumando 1 a todos los datos del array
-#12. Multiply a and c. Assign the result to e.
+# 12. Multiply a and c. Assign the result to e.
+e = numpy.multiply(a, c)
+print(a, c)
+print("e:", e)
+# 13. Does e equal to a? Why or why not?
+print("e equeal to a?", a == e)
+# Porque solo se multiplico x1
-#13. Does e equal to a? Why or why not?
+# 14. Identify the max, min, and mean values in d. Assign those values to variables "d_max", "d_min", and "d_mean"
+d_max = d.max()
+d_min = d.min()
+d_mean = d.mean()
+print("Max:", d_max, "Min:", d_min, "Mean:", d_mean)
-
-#14. Identify the max, min, and mean values in d. Assign those values to variables "d_max", "d_min", and "d_mean"
-
-
-
-
-#15. Now we want to label the values in d. First create an empty array "f" with the same shape (i.e. 2x3x5) as d using `np.empty`.
-
-
+# 15. Now we want to label the values in d. First create an empty array "f" with the same shape (i.e. 2x3x5)
+# as d using `np.empty`.
+f = numpy.empty((2, 3, 5),dtype=object)
"""
-#16. Populate the values in f. For each value in d, if it's larger than d_min but smaller than d_mean, assign 25 to the corresponding value in f.
+#16. Populate the values in f. For each value in d, if it's larger than d_min but smaller than d_mean, assign 25 to the
+corresponding value in f.
If a value in d is larger than d_mean but smaller than d_max, assign 75 to the corresponding value in f.
If a value equals to d_mean, assign 50 to the corresponding value in f.
Assign 0 to the corresponding value(s) in f for d_min in d.
@@ -74,8 +91,20 @@
In the end, f should have only the following values: 0, 25, 50, 75, and 100.
Note: you don't have to use Numpy in this question.
"""
-
-
+for i in range(len(d)):
+ for j in range(len(d[0])):
+ for k in range(len(d[0, 0])):
+ if d[i, j, k] > d_min and d[i, j, k,] < d_mean:
+ f[i, j, k] = "B"
+ elif d[i, j, k] > d_mean and d[i,j,k,] < d_max:
+ f[i, j, k] = "D"
+ elif d[i, j, k] == d_mean:
+ f[i, j, k] = "C"
+ elif d[i, j, k] == d_min:
+ f[i, j, k] = "A"
+ elif d[i, j, k] == d_max:
+ f[i, j, k] = "E"
+print("F:", f)
"""
@@ -98,11 +127,13 @@
[ 75., 75., 75., 75., 75.],
[ 25., 75., 0., 75., 75.]]])
"""
+print(d)
+print(f)
"""
#18. Bonus question: instead of using numbers (i.e. 0, 25, 50, 75, and 100), how to use string values
-("A", "B", "C", "D", and "E") to label the array elements? You are expecting the result to be:
+("A=0", "B=25", "C=50", "D=75", and "E=100") to label the array elements? You are expecting the result to be:
array([[[ 'D', 'D', 'D', 'B', 'D'],
[ 'D', 'D', 'B', 'B', 'B'],
[ 'D', 'B', 'D', 'D', 'D']],
@@ -111,4 +142,36 @@
[ 'D', 'D', 'D', 'D', 'D'],
[ 'B', 'D', 'A', 'D', 'D']]])
Again, you don't need Numpy in this question.
-"""
\ No newline at end of file
+"""
+'''''''''
+g = numpy.chararray((2,3,5))
+for i in range(len(d)):
+ for j in range(len(d[0])):
+ for k in range(len(d[0,0])):
+ if d[i,j,k] > d_min and d[i,j,k,] < d_mean:
+ g[i,j,k] = 'B'
+ elif d[i,j,k] > d_mean and d[i,j,k,] < d_max:
+ g[i,j,k] = 'D'
+ elif d[i,j,k] == d_mean:
+ g[i,j,k] = 'C'
+ elif d[i,j,k] == d_min:
+ g[i,j,k] = 'A'
+ elif d[i,j,k] == d_max:
+ g[i,j,k] = 'E'
+print(g)
+'''''''''''
+
+for i in range(len(d)):
+ for j in range(len(d[0])):
+ for k in range(len(d[0, 0])):
+ if d[i, j, k] > d_min and d[i, j, k,] < d_mean:
+ f[i, j, k] = 25
+ elif d[i, j, k] > d_mean and d[i,j,k,] < d_max:
+ f[i, j, k] = 75
+ elif d[i, j, k] == d_mean:
+ f[i, j, k] = 50
+ elif d[i, j, k] == d_min:
+ f[i, j, k] = 0
+ elif d[i, j, k] == d_max:
+ f[i, j, k] = 100
+print("F:", f)