Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

计算机2班沈静懿 #619

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions 117.ipynb
Original file line number Diff line number Diff line change
@@ -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
}