Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 83 additions & 28 deletions your-code/main.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"# your code here"
"import numpy as np"
]
},
{
Expand All @@ -28,11 +28,19 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 3,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"1.21.5\n"
]
}
],
"source": [
"# your code here"
"print(np.version.version)"
]
},
{
Expand All @@ -45,25 +53,25 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"# Method 1"
"a = np.random.rand(2, 3, 5)"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"# Method 2"
"a = np.random.random(size = (2,3,5))"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -79,11 +87,25 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 7,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[[[0.77738968 0.81358654 0.59389129 0.41128853 0.4003469 ]\n",
" [0.28666783 0.69644406 0.41998219 0.22159706 0.56501835]\n",
" [0.73808005 0.1297112 0.58609809 0.76265974 0.96834767]]\n",
"\n",
" [[0.24315664 0.0784898 0.89210882 0.1600817 0.10215783]\n",
" [0.21953937 0.25606114 0.53067651 0.62760852 0.46673056]\n",
" [0.96037707 0.95224151 0.26605448 0.95009055 0.09361499]]]\n"
]
}
],
"source": [
"# your code here"
"print(a)"
]
},
{
Expand All @@ -95,11 +117,11 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
"# your code here"
"b = np.ones((5,2,3))"
]
},
{
Expand All @@ -111,11 +133,32 @@
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# your code here"
"execution_count": 9,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[[[1. 1. 1.]\n",
" [1. 1. 1.]]\n",
"\n",
" [[1. 1. 1.]\n",
" [1. 1. 1.]]\n",
"\n",
" [[1. 1. 1.]\n",
" [1. 1. 1.]]\n",
"\n",
" [[1. 1. 1.]\n",
" [1. 1. 1.]]\n",
"\n",
" [[1. 1. 1.]\n",
" [1. 1. 1.]]]\n"
]
}
],
"source": [
"print(b)"
]
},
{
Expand All @@ -127,11 +170,23 @@
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# your code here"
"execution_count": 11,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"(2, 3, 5)\n",
"(5, 2, 3)\n"
]
}
],
"source": [
"# a and b do not have the same size. a has 2 arrays, with 3 rows each and 5 columns. b has 5 arrays, with 2 rows each and 3 columns.\n",
"\n",
"print(a.shape)\n",
"print(b.shape)"
]
},
{
Expand Down Expand Up @@ -163,7 +218,7 @@
"metadata": {},
"outputs": [],
"source": [
"# your code here"
"# your answer here"
]
},
{
Expand Down Expand Up @@ -345,7 +400,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -359,7 +414,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.2"
"version": "3.9.13"
}
},
"nbformat": 4,
Expand Down