Skip to content

Commit

Permalink
Merge pull request #5 from tmu-nlp/momoko
Browse files Browse the repository at this point in the history
message
  • Loading branch information
momok47 authored Apr 15, 2024
2 parents 4d289a5 + b108276 commit ff3df45
Show file tree
Hide file tree
Showing 10 changed files with 798 additions and 0 deletions.
60 changes: 60 additions & 0 deletions momoko/chapter01/knock00.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"desserts\n"
]
}
],
"source": [
"#00\n",
"\n",
"input = \"stressed\"\n",
"output = \"\"\n",
"for m in range (len(input)):\n",
" output = output + input[len(input)-int(m+1)]#後ろからどんどん参照する\n",
"\n",
"print(output)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"interpreter": {
"hash": "34ccacd3b6fdbd462b750c5ef896413565fa613738e46158bd59146bdd5a1dd5"
},
"kernelspec": {
"display_name": "Python 3.11.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.11.3"
},
"orig_nbformat": 4
},
"nbformat": 4,
"nbformat_minor": 2
}
62 changes: 62 additions & 0 deletions momoko/chapter01/knock01.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"タクシー\n"
]
}
],
"source": [
"#01\n",
"\n",
"input = \"パタトクカシーー\"\n",
"output = \"\"\n",
"#print(len(input)) ->8だった\n",
"\n",
"for i in range (int(len(input)/2)):\n",
" output = output + input[2*i+1]#奇数番目だけ\n",
"\n",
"print(output)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"interpreter": {
"hash": "34ccacd3b6fdbd462b750c5ef896413565fa613738e46158bd59146bdd5a1dd5"
},
"kernelspec": {
"display_name": "Python 3.11.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.11.3"
},
"orig_nbformat": 4
},
"nbformat": 4,
"nbformat_minor": 2
}
62 changes: 62 additions & 0 deletions momoko/chapter01/knock02.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"パタトクカシーー\n"
]
}
],
"source": [
"#02\n",
"\n",
"pato=\"パトカー\"\n",
"taku=\"タクシー\"\n",
"output=\"\"\n",
"\n",
"for i in range(len(pato)):\n",
" output = output + pato[i] + taku[i]\n",
"\n",
"print(output)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"interpreter": {
"hash": "34ccacd3b6fdbd462b750c5ef896413565fa613738e46158bd59146bdd5a1dd5"
},
"kernelspec": {
"display_name": "Python 3.11.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.11.3"
},
"orig_nbformat": 4
},
"nbformat": 4,
"nbformat_minor": 2
}
62 changes: 62 additions & 0 deletions momoko/chapter01/knock03.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[3, 1, 4, 1, 6, 9, 2, 7, 5, 3, 5, 8, 9, 7, 10]\n"
]
}
],
"source": [
"#03\n",
"\n",
"input=\"Now I need a drink, alcoholic of course, after the heavy lectures involving quantum mechanics.\"\n",
"mojisuu_list=[]\n",
"\n",
"imput_sp = input.split(\" \")\n",
"for word in imput_sp:\n",
" mojisuu_list.append(len(word))\n",
"\n",
"print(mojisuu_list)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"interpreter": {
"hash": "34ccacd3b6fdbd462b750c5ef896413565fa613738e46158bd59146bdd5a1dd5"
},
"kernelspec": {
"display_name": "Python 3.11.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.11.3"
},
"orig_nbformat": 4
},
"nbformat": 4,
"nbformat_minor": 2
}
69 changes: 69 additions & 0 deletions momoko/chapter01/knock04.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"<class 'dict'>\n",
"{0: 'Hi', 1: 'H', 2: 'Li', 3: 'Be', 4: 'Bo', 5: 'C', 6: 'N', 7: 'O', 8: 'F', 9: 'N', 10: 'Na', 11: 'Mi', 12: 'Al', 13: 'Si', 14: 'Pe', 15: 'S', 16: 'C', 17: 'Ar', 18: 'Ki', 19: 'C'}\n"
]
}
],
"source": [
"#04\n",
"\n",
"input=\"Hi He Lied Because Boron Could Not Oxidize Fluorine. New Nations Might Also Sign Peace Security Clause. Arthur King Can.\"\n",
"king_list=[]\n",
"num_list = [1, 5, 6, 7, 8, 9, 15, 16, 19]\n",
"input_sp = input.split(\" \")\n",
"\n",
"for num in range (len(input_sp)):\n",
" if num in num_list:\n",
" king_list.append([num,input_sp[num][0]])#何番目か,input_spから対応する一文字目だけ持ってくる\n",
" else:\n",
" king_list.append([num,input_sp[num][0:2]])#何番目か,input_spから対応する1&2文字目だけ持ってくる\n",
"\n",
"king_dict = dict(king_list)#リストから辞書化\n",
"print(type(king_dict))\n",
"print(king_dict)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"interpreter": {
"hash": "34ccacd3b6fdbd462b750c5ef896413565fa613738e46158bd59146bdd5a1dd5"
},
"kernelspec": {
"display_name": "Python 3.11.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.11.3"
},
"orig_nbformat": 4
},
"nbformat": 4,
"nbformat_minor": 2
}
Loading

0 comments on commit ff3df45

Please sign in to comment.