deux cellules

parent 608c32e2
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Fichier test de calculs en python"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## boucle for"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0\n",
"1\n",
"2\n",
"3\n",
"4\n"
]
}
],
"source": [
"for i in range(5): # ici un commentaire du code\n",
" print(i)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"texte simple comme un commentaire des résultats"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## test if / else"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0\n",
"nombre pair\n"
]
}
],
"source": [
"var1 = 10\n",
"print(var1 % 2)\n",
"if (var1 % 2) == 0:\n",
" print (\"nombre pair\"), var1\n",
"else:\n",
" print (\"nombre impair\"), var1"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"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.6.4"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment