From e25fe0e42b3fd198d28a9a744f576023f1fec63d Mon Sep 17 00:00:00 2001 From: janeshenjingyi <33061408+janeshenjingyi@users.noreply.github.com> Date: Tue, 7 Nov 2017 21:27:19 +0800 Subject: [PATCH] Add files via upload --- 117.ipynb | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 117.ipynb diff --git a/117.ipynb b/117.ipynb new file mode 100644 index 000000000..d12bcf604 --- /dev/null +++ b/117.ipynb @@ -0,0 +1,69 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "请输入一个较大的大于等于0的整数,作为上界,回车结束。500\n", + "请输入一个较小的大于等于0的整数,作为下界,回车结束。10\n", + "请输入一个大于0的整数,作为随机整数的数目,回车结束。5\n", + "37.749172176353746\n" + ] + } + ], + "source": [ + "import math,random\n", + "def guess_game():\n", + " k = int(input('请输入一个较大的大于等于0的整数,作为上界,回车结束。'))\n", + " n = int(input('请输入一个较小的大于等于0的整数,作为下界,回车结束。'))\n", + " m = int(input('请输入一个大于0的整数,作为随机整数的数目,回车结束。'))\n", + " total=0\n", + " guess_times=0\n", + " while guess_times < m:\n", + " number = random.randint(n,k)\n", + " total+=number\n", + " guess_times += 1\n", + " \n", + " print(math.sqrt(total))\n", + "guess_game() " + ] + }, + { + "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.6.0" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +}