From 14ae94171dd1855dbf7326493ae9cafbae51b78c Mon Sep 17 00:00:00 2001 From: tacchan7412 Date: Sat, 17 Jun 2017 15:13:46 +0900 Subject: [PATCH 1/2] add assignment --- .../Tatsuki_Koga-checkpoint.ipynb | 226 ++++++++++++++++++ Tatsuki_Koga/README.md | 5 + Tatsuki_Koga/Tatsuki_Koga.ipynb | 226 ++++++++++++++++++ 3 files changed, 457 insertions(+) create mode 100644 Tatsuki_Koga/.ipynb_checkpoints/Tatsuki_Koga-checkpoint.ipynb create mode 100644 Tatsuki_Koga/README.md create mode 100644 Tatsuki_Koga/Tatsuki_Koga.ipynb diff --git a/Tatsuki_Koga/.ipynb_checkpoints/Tatsuki_Koga-checkpoint.ipynb b/Tatsuki_Koga/.ipynb_checkpoints/Tatsuki_Koga-checkpoint.ipynb new file mode 100644 index 0000000..f90eb3a --- /dev/null +++ b/Tatsuki_Koga/.ipynb_checkpoints/Tatsuki_Koga-checkpoint.ipynb @@ -0,0 +1,226 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# 課題1" + ] + }, + { + "cell_type": "code", + "execution_count": 44, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/plain": [ + "[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]" + ] + }, + "execution_count": 44, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "list(range(1,11))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# 課題2" + ] + }, + { + "cell_type": "code", + "execution_count": 43, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/plain": [ + "[2, 4, 6, 8, 10]" + ] + }, + "execution_count": 43, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "list(range(2,11,2))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# 課題3" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/plain": [ + "{0: 'a', 1: 'b', 2: 'c', 3: 'd', 4: 'e', 5: 'f'}" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "alph_list = [\"a\",\"b\",\"c\",\"d\",\"e\",\"f\"]\n", + "dict(enumerate(alph_list))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# 課題4" + ] + }, + { + "cell_type": "code", + "execution_count": 37, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "名前: 山田, 年齢: 23歳, 性別: 男, 身長: 170.3cm, 体重: 60.2kg\n", + "名前: 高橋, 年齢: 30歳, 性別: 女, 身長: 165.2cm, 体重: 46.2kg\n", + "名前: 山田, 年齢: 24歳, 性別: 男, 身長: 170.3cm, 体重: 60.2kg\n", + "2\n" + ] + } + ], + "source": [ + "instance_count = 0\n", + "class Human:\n", + " def __init__(self, name, age, sex, height, weight):\n", + " self.name = name\n", + " self.age = age\n", + " self.sex = sex\n", + " self.height = height\n", + " self.weight = weight\n", + " global instance_count\n", + " instance_count += 1\n", + " \n", + " def __str__(self):\n", + " return '名前: %s, 年齢: %d歳, 性別: %s, 身長: %.1fcm, 体重: %.1fkg' %(self.name,self.age,self.sex,self.height,self.weight)\n", + " \n", + " def inc_age(self):\n", + " self.age += 1\n", + " \n", + " def instance_count(self):\n", + " return count\n", + " \n", + "\n", + "# インスタンスの作成\n", + "yamada = Human('山田', 23, '男', 170.3, 60.2)\n", + "takahashi = Human(\"高橋\", 30, '女', 165.2, 46.2)\n", + "print(yamada)\n", + "print(takahashi)\n", + "# 年齢をインクリメント\n", + "yamada.inc_age()\n", + "print(yamada)\n", + "# インスタンスをカウントした結果\n", + "print(instance_count)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# 課題5" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "import numpy as np\n", + "a = np.array([[1,2,3],[4,5,6]])\n", + "b = np.array([1,1,1])\n", + "np.matmul(a,b.T)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# 課題6" + ] + }, + { + "cell_type": "code", + "execution_count": 52, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/plain": [ + "0.96886393162696616" + ] + }, + "execution_count": 52, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import numpy as np\n", + "a = np.array([1,2,3,4])\n", + "b = np.array([5,6,7,8])\n", + "np.matmul(a,b.T) / (np.linalg.norm(a)*np.linalg.norm(b))" + ] + } + ], + "metadata": { + "anaconda-cloud": {}, + "kernelspec": { + "display_name": "Python [conda root]", + "language": "python", + "name": "conda-root-py" + }, + "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.5.2" + } + }, + "nbformat": 4, + "nbformat_minor": 1 +} diff --git a/Tatsuki_Koga/README.md b/Tatsuki_Koga/README.md new file mode 100644 index 0000000..ef82721 --- /dev/null +++ b/Tatsuki_Koga/README.md @@ -0,0 +1,5 @@ +$BL>A0(B: $B8E2l(B: $BEl5~Bg3X(B +$B@l96(B: $B8=:_65M\3XIt$N$?$a$J$7(B +$B:#$^$G$N3+H/7P83(B: Go$B$G$N(BWeb$B%P%C%/%(%s%I3+H/!"(BPython$B$G$N5!3#3X=,!"(BDeep Learning$B$N Date: Sat, 17 Jun 2017 15:27:13 +0900 Subject: [PATCH 2/2] fix README --- Tatsuki_Koga/README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Tatsuki_Koga/README.md b/Tatsuki_Koga/README.md index ef82721..4dd33e8 100644 --- a/Tatsuki_Koga/README.md +++ b/Tatsuki_Koga/README.md @@ -1,5 +1,5 @@ -$BL>A0(B: $B8E2l(B: $BEl5~Bg3X(B -$B@l96(B: $B8=:_65M\3XIt$N$?$a$J$7(B -$B:#$^$G$N3+H/7P83(B: Go$B$G$N(BWeb$B%P%C%/%(%s%I3+H/!"(BPython$B$G$N5!3#3X=,!"(BDeep Learning$B$N