From 78d090cf4c8b205f0e2f3e6618dfdc91014755c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A8=8B=E8=BF=9C?= <10669202+chengyuan42cy@user.noreply.gitee.com> Date: Sun, 10 Apr 2022 12:39:26 +0000 Subject: [PATCH 1/3] =?UTF-8?q?=E7=AC=AC=E4=B8=80=E6=AC=A1=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 202122011108.ipynb | 170 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 170 insertions(+) create mode 100644 202122011108.ipynb diff --git a/202122011108.ipynb b/202122011108.ipynb new file mode 100644 index 0000000..cad2b2d --- /dev/null +++ b/202122011108.ipynb @@ -0,0 +1,170 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Count for A : 20\n", + "Count for T : 20\n", + "Count for C : 12\n", + "Count for G : 17\n" + ] + } + ], + "source": [ + "items = ['A','G','C','T','T','T,','T','C','A','T','T','C','T','G','A','C','T','G','C','A','A','C','G','G',\n", + " 'G','C','A','A','T','A','T','G','T','C','T','C','T','G','T','G','T','G','G','A','T','T','A',\n", + " 'A','A','A','A','A','A','G','A','G','T','G','T','C','T','G','A','T','A','G','C','A','G','C']\n", + "print (\"Count for A : \",items.count('A'))\n", + "print (\"Count for T : \",items.count('T'))\n", + "print (\"Count for C : \",items.count('C'))\n", + "print (\"Count for G : \",items.count('G'))" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": {}, + "outputs": [ + { + "ename": "IndentationError", + "evalue": "unexpected indent (, line 5)", + "output_type": "error", + "traceback": [ + "\u001b[0;36m File \u001b[0;32m\"\"\u001b[0;36m, line \u001b[0;32m5\u001b[0m\n\u001b[0;31m scores.append(i)\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mIndentationError\u001b[0m\u001b[0;31m:\u001b[0m unexpected indent\n" + ] + } + ], + "source": [ + "\n", + " " + ] + }, + { + "cell_type": "code", + "execution_count": 29, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "(0.25, 0.5, 0.75, 1.0, 1.25, 1.5, 1.75, 2.0, 2.25, 2.5, 2.75, 3.0, 3.25, 3.5, 3.75, 4.0, 4.25, 4.5, 4.75, 5.0, 5.25, 5.5, 5.75, 6.0, 6.25, 6.5, 6.75, 7.0, 7.25, 7.5, 7.75, 8.0, 8.25, 8.5, 8.75, 9.0, 9.25, 9.5, 9.75, 10.0)\n", + "一个运动员可能得0.25分。\n", + "一个运动员可能得0.5分。\n", + "一个运动员可能得0.75分。\n", + "一个运动员可能得1.0分。\n", + "一个运动员可能得1.25分。\n", + "一个运动员可能得1.5分。\n", + "一个运动员可能得1.75分。\n", + "一个运动员可能得2.0分。\n", + "一个运动员可能得2.25分。\n", + "一个运动员可能得2.5分。\n", + "一个运动员可能得2.75分。\n", + "一个运动员可能得3.0分。\n", + "一个运动员可能得3.25分。\n", + "一个运动员可能得3.5分。\n", + "一个运动员可能得3.75分。\n", + "一个运动员可能得4.0分。\n", + "一个运动员可能得4.25分。\n", + "一个运动员可能得4.5分。\n", + "一个运动员可能得4.75分。\n", + "一个运动员可能得5.0分。\n", + "一个运动员可能得5.25分。\n", + "一个运动员可能得5.5分。\n", + "一个运动员可能得5.75分。\n", + "一个运动员可能得6.0分。\n", + "一个运动员可能得6.25分。\n", + "一个运动员可能得6.5分。\n", + "一个运动员可能得6.75分。\n", + "一个运动员可能得7.0分。\n", + "一个运动员可能得7.25分。\n", + "一个运动员可能得7.5分。\n", + "一个运动员可能得7.75分。\n", + "一个运动员可能得8.0分。\n", + "一个运动员可能得8.25分。\n", + "一个运动员可能得8.5分。\n", + "一个运动员可能得8.75分。\n", + "一个运动员可能得9.0分。\n", + "一个运动员可能得9.25分。\n", + "一个运动员可能得9.5分。\n", + "一个运动员可能得9.75分。\n", + "一个运动员可能得10.0分。\n" + ] + } + ], + "source": [ + "score = ()\n", + "n = int(10/0.25)\n", + "for i in range(n):\n", + " score += ((i+1)*0.25,)\n", + "print(score)\n", + " \n", + " \n", + "for j in score:\n", + " if j != 0.0:\n", + " print(\"一个运动员可能得\" + str(j) + \"分。\")" + ] + }, + { + "cell_type": "code", + "execution_count": 33, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "臭豆腐是长沙的一种美食,它的主要原料是豆子\n", + "北京烤鸭是北京的一种美食,它的主要原料是鸭子\n", + "双皮奶是广州的一种美食,它的主要原料是奶\n" + ] + } + ], + "source": [ + "foods = {'臭豆腐': {'城市': '长沙', '原料': '豆子'},\n", + " '北京烤鸭': {'城市': '北京', '原料': '鸭子'},\n", + " '双皮奶': {'城市': '广州', '原料': '奶'},\n", + " }\n", + "\n", + "\n", + "for key,value in foods.items():\n", + " print(key+'是'+value['城市']+'的一种美食,它的主要原料是'+value['原料'])\n", + " " + ] + }, + { + "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.7.6" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} -- Gitee From 4b9751b99d8b82f351f87e51576ccbc08dc2ddae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A8=8B=E8=BF=9C?= <10669202+chengyuan42cy@user.noreply.gitee.com> Date: Sun, 10 Apr 2022 12:42:51 +0000 Subject: [PATCH 2/3] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20.git?= =?UTF-8?q?ignore?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 138 ----------------------------------------------------- 1 file changed, 138 deletions(-) delete mode 100644 .gitignore diff --git a/.gitignore b/.gitignore deleted file mode 100644 index a81c8ee..0000000 --- a/.gitignore +++ /dev/null @@ -1,138 +0,0 @@ -# Byte-compiled / optimized / DLL files -__pycache__/ -*.py[cod] -*$py.class - -# C extensions -*.so - -# Distribution / packaging -.Python -build/ -develop-eggs/ -dist/ -downloads/ -eggs/ -.eggs/ -lib/ -lib64/ -parts/ -sdist/ -var/ -wheels/ -share/python-wheels/ -*.egg-info/ -.installed.cfg -*.egg -MANIFEST - -# PyInstaller -# Usually these files are written by a python script from a template -# before PyInstaller builds the exe, so as to inject date/other infos into it. -*.manifest -*.spec - -# Installer logs -pip-log.txt -pip-delete-this-directory.txt - -# Unit test / coverage reports -htmlcov/ -.tox/ -.nox/ -.coverage -.coverage.* -.cache -nosetests.xml -coverage.xml -*.cover -*.py,cover -.hypothesis/ -.pytest_cache/ -cover/ - -# Translations -*.mo -*.pot - -# Django stuff: -*.log -local_settings.py -db.sqlite3 -db.sqlite3-journal - -# Flask stuff: -instance/ -.webassets-cache - -# Scrapy stuff: -.scrapy - -# Sphinx documentation -docs/_build/ - -# PyBuilder -.pybuilder/ -target/ - -# Jupyter Notebook -.ipynb_checkpoints - -# IPython -profile_default/ -ipython_config.py - -# pyenv -# For a library or package, you might want to ignore these files since the code is -# intended to run in multiple environments; otherwise, check them in: -# .python-version - -# pipenv -# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. -# However, in case of collaboration, if having platform-specific dependencies or dependencies -# having no cross-platform support, pipenv may install dependencies that don't work, or not -# install all needed dependencies. -#Pipfile.lock - -# PEP 582; used by e.g. github.com/David-OConnor/pyflow -__pypackages__/ - -# Celery stuff -celerybeat-schedule -celerybeat.pid - -# SageMath parsed files -*.sage.py - -# Environments -.env -.venv -env/ -venv/ -ENV/ -env.bak/ -venv.bak/ - -# Spyder project settings -.spyderproject -.spyproject - -# Rope project settings -.ropeproject - -# mkdocs documentation -/site - -# mypy -.mypy_cache/ -.dmypy.json -dmypy.json - -# Pyre type checker -.pyre/ - -# pytype static type analyzer -.pytype/ - -# Cython debug symbols -cython_debug/ -- Gitee From e1f6837efd91da60fc2236580b1fb637ce13f09a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A8=8B=E8=BF=9C?= <10669202+chengyuan42cy@user.noreply.gitee.com> Date: Sun, 10 Apr 2022 12:42:57 +0000 Subject: [PATCH 3/3] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=202021?= =?UTF-8?q?22011058.ipynb?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 202122011058.ipynb | 281 --------------------------------------------- 1 file changed, 281 deletions(-) delete mode 100644 202122011058.ipynb diff --git a/202122011058.ipynb b/202122011058.ipynb deleted file mode 100644 index 92397d6..0000000 --- a/202122011058.ipynb +++ /dev/null @@ -1,281 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "44b4398c", - "metadata": {}, - "source": [ - "# 作业要求以学号命名,类似\"123456.ipynb\",不需要加姓名。\n", - "\n", - "\n", - "作业提交的方式见下面链接:\n", - "https://blog.csdn.net/sheagu/article/details/122397816" - ] - }, - { - "cell_type": "markdown", - "id": "5d3dca5a", - "metadata": {}, - "source": [ - "## 题目一\n", - "\n", - "有一个这样的DNA核酸序列\n", - "\n", - "“AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC”\n", - "\n", - "请把这个核酸序列存入一个list,并数一数A、G、C、T各有多少个。" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "id": "e6521351", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "A有20个\n", - "G有17个\n", - "C有12个\n", - "T有21个\n" - ] - } - ], - "source": [ - "DNA = ['AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC']\n", - "A_num = 0\n", - "G_num = 0\n", - "C_num = 0\n", - "T_num = 0\n", - "for i in DNA[0]:\n", - " if i == 'A':\n", - " A_num += 1\n", - " elif i == 'G':\n", - " G_num += 1\n", - " elif i == 'C':\n", - " C_num += 1 \n", - " elif i == 'T':\n", - " T_num += 1\n", - "print(\"A有\" + str(A_num) + \"个\")\n", - "print(\"G有\" + str(G_num) + \"个\")\n", - "print(\"C有\" + str(C_num) + \"个\")\n", - "print(\"T有\" + str(T_num) + \"个\")\n", - "#以下为将DNA序列每个字母作为一个元素存入列表的情况\n", - "xulie = \"AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC\"\n", - "dna = []\n", - "for j in xulie:\n", - " dna.append(j)\n", - "a_num = 0\n", - "g_num = 0\n", - "c_num = 0\n", - "t_num = 0\n", - "for i in dna:\n", - " if i == 'A':\n", - " a_num += 1\n", - " elif i == 'G':\n", - " g_num += 1\n", - " elif i == 'C':\n", - " c_num += 1 \n", - " elif i == 'T':\n", - " t_num += 1" - ] - }, - { - "cell_type": "markdown", - "id": "daf8500d", - "metadata": {}, - "source": [ - "## 题目二\n", - "\n", - "一个花样滑冰运动员表演后,裁判给表演内容进行评分,分数从0.25分到10分,每次增加值为0.25分。\n", - "\n", - "试生成一个元组,把可能的得分存入元组,并遍历元组的每一项,打印“一个运动员可能得_____分”。" - ] - }, - { - "cell_type": "code", - "execution_count": 38, - "id": "90604ebb", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "(0.0, 0.25, 0.5, 0.75, 1.0, 1.25, 1.5, 1.75, 2.0, 2.25, 2.5, 2.75, 3.0, 3.25, 3.5, 3.75, 4.0, 4.25, 4.5, 4.75, 5.0, 5.25, 5.5, 5.75, 6.0, 6.25, 6.5, 6.75, 7.0, 7.25, 7.5, 7.75, 8.0, 8.25, 8.5, 8.75, 9.0, 9.25, 9.5, 9.75, 10.0)\n", - "一个运动员可能得0.0分。\n", - "一个运动员可能得0.25分。\n", - "一个运动员可能得0.5分。\n", - "一个运动员可能得0.75分。\n", - "一个运动员可能得1.0分。\n", - "一个运动员可能得1.25分。\n", - "一个运动员可能得1.5分。\n", - "一个运动员可能得1.75分。\n", - "一个运动员可能得2.0分。\n", - "一个运动员可能得2.25分。\n", - "一个运动员可能得2.5分。\n", - "一个运动员可能得2.75分。\n", - "一个运动员可能得3.0分。\n", - "一个运动员可能得3.25分。\n", - "一个运动员可能得3.5分。\n", - "一个运动员可能得3.75分。\n", - "一个运动员可能得4.0分。\n", - "一个运动员可能得4.25分。\n", - "一个运动员可能得4.5分。\n", - "一个运动员可能得4.75分。\n", - "一个运动员可能得5.0分。\n", - "一个运动员可能得5.25分。\n", - "一个运动员可能得5.5分。\n", - "一个运动员可能得5.75分。\n", - "一个运动员可能得6.0分。\n", - "一个运动员可能得6.25分。\n", - "一个运动员可能得6.5分。\n", - "一个运动员可能得6.75分。\n", - "一个运动员可能得7.0分。\n", - "一个运动员可能得7.25分。\n", - "一个运动员可能得7.5分。\n", - "一个运动员可能得7.75分。\n", - "一个运动员可能得8.0分。\n", - "一个运动员可能得8.25分。\n", - "一个运动员可能得8.5分。\n", - "一个运动员可能得8.75分。\n", - "一个运动员可能得9.0分。\n", - "一个运动员可能得9.25分。\n", - "一个运动员可能得9.5分。\n", - "一个运动员可能得9.75分。\n", - "一个运动员可能得10.0分。\n" - ] - } - ], - "source": [ - "score = ()\n", - "n = int(10/0.25 + 1)\n", - "for i in range(n):\n", - " score += (i*0.25,)\n", - " \n", - "print(score)\n", - "\n", - "for j in score:\n", - " print(\"一个运动员可能得\" + str(j) + \"分。\")" - ] - }, - { - "cell_type": "markdown", - "id": "0c3a4e99", - "metadata": {}, - "source": [ - "## 题目三\n", - "\n", - "创建一个字典,列出你所了解的地域美食,比如{'肠粉':{'城市':'广州','原料':'米'}}。当然,你可以做的更丰富一些。\n", - "最后遍历你熟悉的美食,打印出,类似如下的句子:“肠粉是广州的一种美食,它的主要原料是米”。" - ] - }, - { - "cell_type": "code", - "execution_count": 52, - "id": "b0026af6", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "涮羊肉是北京的一种美食,它的主要原料是羊肉\n", - "巴克拉瓦(蜜饼)是西亚各国的一种美食,它的主要原料是酥皮、坚果\n", - "烤鸭是北京的一种美食,它的主要原料是鸭子\n", - "糖醋鲤鱼是济南的一种美食,它的主要原料是鲤鱼\n" - ] - } - ], - "source": [ - "food = {'涮羊肉':{'城市':'北京','原料':'羊肉'},\n", - " '巴克拉瓦(蜜饼)':{'城市':'西亚各国','原料':'酥皮、坚果'},\n", - " '烤鸭':{'城市':'北京','原料':'鸭子'},\n", - " '糖醋鲤鱼':{'城市':'济南','原料':'鲤鱼'}\n", - " }\n", - "for key,value in food.items():\n", - " print(key + '是' + value['城市'] + '的一种美食,它的主要原料是' + value['原料'])" - ] - }, - { - "cell_type": "code", - "execution_count": 56, - "id": "4c3a6bc9", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "凯尔希是六星医疗干员。\n", - "阿米娅是五星术士/近卫干员。\n", - "史尔特尔是六星近卫干员。\n", - "浊心斯卡蒂是六星辅助干员。\n", - "风笛是六星先锋干员。\n", - "塞雷娅是六星重装干员。\n", - "能天使是六星狙击干员。\n", - "温蒂是六星特种干员。\n" - ] - } - ], - "source": [ - "##随便写了个别的\n", - "Users = {'凯尔希':{'星级':'六星','职介':'医疗'},\n", - " '阿米娅':{'星级':'五星','职介':'术士/近卫'},\n", - " '史尔特尔':{'星级':'六星','职介':'近卫'},\n", - " '浊心斯卡蒂':{'星级':'六星','职介':'辅助'},\n", - " '风笛':{'星级':'六星','职介':'先锋'},\n", - " '塞雷娅':{'星级':'六星','职介':'重装'},\n", - " '能天使':{'星级':'六星','职介':'狙击'},\n", - " '温蒂':{'星级':'六星','职介':'特种'}\n", - " }\n", - "for key,value in Users.items():\n", - " print(key + '是' + value['星级'] + value['职介'] + '干员。')" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "7c9bb8ac", - "metadata": {}, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "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.7.0" - }, - "toc": { - "base_numbering": 1, - "nav_menu": {}, - "number_sections": false, - "sideBar": true, - "skip_h1_title": false, - "title_cell": "Table of Contents", - "title_sidebar": "Contents", - "toc_cell": false, - "toc_position": {}, - "toc_section_display": true, - "toc_window_display": false - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} -- Gitee