{ "cells": [ { "cell_type": "code", "execution_count": 27, "metadata": { "collapsed": false }, "outputs": [], "source": [ "a = 0.7\n", "b = 2\n", "longueurs = np.arange(10)\n", "ecart = np.random.normal(0,1,10)\n", "valeurs = a*longueurs + b + 0.5*ecart" ] }, { "cell_type": "code", "execution_count": 28, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "array([ 1.74415298, 2.28900387, 2.66515751, 3.22369361, 4.75102876,\n", " 5.77744568, 7.01348165, 7.51017164, 7.11560104, 7.90809218])" ] }, "execution_count": 28, "metadata": {}, "output_type": "execute_result" } ], "source": [ "valeurs" ] }, { "cell_type": "code", "execution_count": 29, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " (0,1.74) (1,2.29) (2,2.67) (3,3.22) (4,4.75) (5,5.78) (6,7.01) (7,7.51) (8,7.12) (9,7.91) \n" ] } ], "source": [ "ans = \"\"\n", "for (i,a) in enumerate(valeurs):\n", " ans += \" ({},{}) \".format(longueurs[i],round(a,2))\n", "print(ans)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "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.4.3" } }, "nbformat": 4, "nbformat_minor": 0 }