This repository has been archived by the owner on Jan 13, 2024. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
838 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
{ | ||
"metadata": { | ||
"name": "", | ||
"signature": "sha256:4291930ae5a00c88259a610b5f611a227a10ddada4ef754dae7c8bd8aa3811e0" | ||
}, | ||
"nbformat": 3, | ||
"nbformat_minor": 0, | ||
"worksheets": [ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "heading", | ||
"level": 1, | ||
"metadata": {}, | ||
"source": [ | ||
"Deviner un nombre al\u00e9atoire" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"**Q1 :** Ecrire une jeu dans lequel python choisi al\u00e9atoirement un nombre entre 0 et 100, et essayer de trouver ce nombre en 10 \u00e9tapes (avec la fonction [open_window_params](http://www.xavierdupre.fr/app/pyquickhelper/helpsphinx/pyquickhelper/funcwin/frame_params.html?highlight=open#pyquickhelper.funcwin.frame_params.open_window_params))." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"collapsed": false, | ||
"input": [ | ||
"from pyquickhelper import open_window_params\n", | ||
"def demande_nombre(appreciation):\n", | ||
" params = { \"nombre\":\"\" }\n", | ||
" ans = open_window_params (params, title=\"Entrez un nombre\", \n", | ||
" help_string = appreciation, \n", | ||
" key_save=\"alean\")\n", | ||
" nb = int( ans[\"nombre\"] ) \n", | ||
" return nb\n", | ||
"nb = demande_nombre(\"?\")\n", | ||
"nb" | ||
], | ||
"language": "python", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"metadata": {}, | ||
"output_type": "pyout", | ||
"prompt_number": 5, | ||
"text": [ | ||
"7" | ||
] | ||
} | ||
], | ||
"prompt_number": 5 | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"** Q2 :** Transformer ce jeu en une fonction ``jeu(nVies)`` o\u00f9 ``nVies`` est le nombre d'it\u00e9rations maximum." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"collapsed": false, | ||
"input": [], | ||
"language": "python", | ||
"metadata": {}, | ||
"outputs": [] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"**Q3 : ** Adapter le code pour faire une classe joueur avec une m\u00e9thode jouer, o\u00f9 un joueur est d\u00e9fini par un pseudo et son nombre de vies. Faire jouer deux joueurs et d\u00e9terminer le vainqueur." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"collapsed": false, | ||
"input": [], | ||
"language": "python", | ||
"metadata": {}, | ||
"outputs": [] | ||
} | ||
], | ||
"metadata": {} | ||
} | ||
] | ||
} |
Oops, something went wrong.