diff --git a/Untitled.ipynb b/Untitled.ipynb new file mode 100644 index 0000000000000000000000000000000000000000..a80aaedfe116c126df29fd53dfcab11c859ca775 --- /dev/null +++ b/Untitled.ipynb @@ -0,0 +1,181 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "20 12 17 21 " + ] + } + ], + "source": [ + "# 题目一\n", + "# 有一个这样的DNA核酸序列“AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC”.请把这个核酸序列存入一个list,并数一数A、G、C、T各有多少个。\n", + "\n", + "str_dna='AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC'\n", + "list_dna=['A','C','G','T']\n", + "for i in range(len(list_dna)):\n", + " print(str_dna.count(list_dna[i]),'',end='') " + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "一个运动员可能得0.25分\n", + "\n", + "一个运动员可能得0.5分\n", + "\n", + "一个运动员可能得0.75分\n", + "\n", + "一个运动员可能得1分\n", + "\n", + "一个运动员可能得1.25分\n", + "\n", + "一个运动员可能得1.5分\n", + "\n", + "一个运动员可能得1.75分\n", + "\n", + "一个运动员可能得2分\n", + "\n", + "一个运动员可能得2.25分\n", + "\n", + "一个运动员可能得2.5分\n", + "\n", + "一个运动员可能得2.75分\n", + "\n", + "一个运动员可能得3分\n", + "\n", + "一个运动员可能得3.25分\n", + "\n", + "一个运动员可能得3.5分\n", + "\n", + "一个运动员可能得3.75分\n", + "\n", + "一个运动员可能得4分\n", + "\n", + "一个运动员可能得4.25分\n", + "\n", + "一个运动员可能得4.5分\n", + "\n", + "一个运动员可能得4.75分\n", + "\n", + "一个运动员可能得5分\n", + "\n", + "一个运动员可能得5.25分\n", + "\n", + "一个运动员可能得5.5分\n", + "\n", + "一个运动员可能得5.75分\n", + "\n", + "一个运动员可能得6分\n", + "\n", + "一个运动员可能得6.25分\n", + "\n", + "一个运动员可能得6.5分\n", + "\n", + "一个运动员可能得6.75分\n", + "\n", + "一个运动员可能得7分\n", + "\n", + "一个运动员可能得7.25分\n", + "\n", + "一个运动员可能得7.5分\n", + "\n", + "一个运动员可能得7.75分\n", + "\n", + "一个运动员可能得8分\n", + "\n", + "一个运动员可能得8.25分\n", + "\n", + "一个运动员可能得8.5分\n", + "\n", + "一个运动员可能得8.75分\n", + "\n", + "一个运动员可能得9分\n", + "\n", + "一个运动员可能得9.25分\n", + "\n", + "一个运动员可能得9.5分\n", + "\n", + "一个运动员可能得9.75分\n", + "\n", + "一个运动员可能得10分\n" + ] + } + ], + "source": [ + "# 题目二\n", + "# 一个花样滑冰运动员表演后,裁判给表演内容进行评分,分数从0.25分到10分,每次增加值为0.25分。\n", + "\n", + "# 试生成一个元组,把可能的得分存入元组,并遍历元组的每一项,打印“一个运动员可能得_____分”。\n", + "\n", + "tuple_goal=(0.25,0.5,0.75,1,1.25,1.5,1.75,2,2.25,2.5,2.75,3,3.25,3.5,3.75,4,4.25,4.5,4.75,5,5.25,5.5,5.75,6,6.25,6.5,6.75,7,7.25,7.5,7.75,8,8.25,8.5,8.75,9,9.25,9.5,9.75,10)\n", + "for goal in tuple_goal:\n", + " print(\"\\n一个运动员可能得\"+str(goal)+\"分\")" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "肠粉是广州的一种美食,他的主要原料是米\n", + "烤冷面是哈尔滨的一种美食,他的主要原料是米\n", + "辣条是郑州的一种美食,他的主要原料是大豆\n" + ] + } + ], + "source": [ + "# 题目三:\n", + "# 创建一个字典,列出你所了解的地域美食,比如{'肠粉':{'城市':'广州','原料':'米'}}。当然,你可以做的更丰富一些。 最后遍历你熟悉的美食,打印出,类似如下的句子:“肠粉是广州的一种美食,它的主要原料是米”。\n", + "foods = {'肠粉': {'城市': '广州', '原料': '米'},'烤冷面': {'城市': '哈尔滨', '原料': '米'},'辣条': {'城市': '郑州', '原料': '大豆'}}\n", + "for foods_name, foods_information in foods.items():\n", + " print(foods_name.title()+\"是\"+foods_information['城市']+\"的一种美食,他的主要原料是\"+foods_information['原料'])\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.6.5" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +}