Files
training.python.datascience/intro-to-jupyter.ipynb
2025-07-04 19:58:11 +02:00

162 lines
3.2 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
"cells": [
{
"cell_type": "markdown",
"id": "e1ab7cf7-6cf4-4ba6-b3a1-9c4d3d4aa8e9",
"metadata": {},
"source": [
"# Bienvenue dans Jupyter\n",
"\n",
"Cette cellule contient du texte en **Markdown**"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "e7b050ca-32bd-4612-b34e-74b6664fc089",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0.0\n",
"1.0\n"
]
}
],
"source": [
"from math import sin, cos\n",
"print(sin(0))\n",
"print(cos(0))"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "65ea6cd6-a452-45d3-9274-4247e59a5ac3",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[ 5 8 13 21]\n"
]
}
],
"source": [
"import numpy as np\n",
"\n",
"a1 = np.array([5, 8, 13, 21])\n",
"print(a1)"
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "d6a2aa45-03bd-4e52-8f77-98bd1bb6751a",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[[ 1 3 5]\n",
" [ 8 11 14]\n",
" [18 22 26]]\n",
"int32\n",
"9\n",
"(3, 3)\n",
"14\n",
"[[ 5.2 15.6 26. ]\n",
" [ 41.6 57.2 72.8]\n",
" [ 93.6 114.4 135.2]]\n"
]
}
],
"source": [
"import numpy as np\n",
"\n",
"a1 = np.array([[1, 3, 5], [8, 11, 14], [18, 22, 26]], dtype=\"int32\")\n",
"print(a1)\n",
"# Afficher le nom du type des données du tableau\n",
"print(a1.dtype)\n",
"# Afficher le nombre de cellules au total dans le tableau\n",
"print(a1.size)\n",
"# Afficher les dimensions du tableau\n",
"print(a1.shape)\n",
"print(a1[1][2])\n",
"\n",
"# Appliquer un calcul simple à tous les éléments du tableau\n",
"a2 = a1 * 5.2\n",
"print(a2)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "c6f47454-b849-47ad-abfe-a66ca774d038",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"a2 = np.arange(0, 10, 1)\n",
"a2"
]
},
{
"cell_type": "code",
"execution_count": 14,
"id": "b9dca432-8fbf-4370-9917-0c8ad5e7ad38",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[[ 34. 71.5]\n",
" [ 59. 142. ]]\n"
]
}
],
"source": [
"m1 = np.array([[5, 8], [4, 17]])\n",
"m2 = np.array([[2, 1.5], [3, 8]])\n",
"print(m1 @ m2)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.5"
}
},
"nbformat": 4,
"nbformat_minor": 5
}