Skip to content

Instantly share code, notes, and snippets.

@saboyutaka
Last active February 7, 2017 05:55
Show Gist options
  • Save saboyutaka/d789f4d2dc7a2c6bd0486c74c6398898 to your computer and use it in GitHub Desktop.
Save saboyutaka/d789f4d2dc7a2c6bd0486c74c6398898 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Python演習"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## お題1: 今日の曜日は?\n",
"お題: 今日の曜日を日本語で表示させてください\n",
"```\n",
"import datetime\n",
"today = datetime.date.today()\n",
"today.weekday()\n",
"```\n",
"をすると曜日の数字が返って来ます。0が月曜日で、6が日曜日が返って来ます。\n",
"today.weekday()を使って実装してください。\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"1"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# 先にここを実行する、記入はしないでください\n",
"import datetime\n",
"today = datetime.date.today()\n",
"today.weekday()\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# ここに解答を書く\n",
"\n",
"\n",
"\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"出力例:\n",
"\n",
"今日は火曜日です。\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## お題2: 一番大きい数、小さい数字、平均値は?\n",
"お題: 配列の中の一番大きい数字、小さい数字、平均値をそれぞれ表示してください。"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"numbers = [73, 24, 64, 10, 56, 89]"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"# ここに解答を書く\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"出力例:\n",
"```\n",
"89\n",
"10\n",
"52.6666666667\n",
"```"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## お題3: 連絡先をを表示して\n",
"お題: dictに入ったデータを使って連絡先を整形して出力してみましょう。"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"person = {\n",
" \"first_name\": \"太郎\",\n",
" \"last_name\": \"スタートアップ\",\n",
" \"address\": {\n",
" \"post_code\": '904-0004',\n",
" \"prefecture\": \"沖縄県\",\n",
" \"city\": \"沖縄市\",\n",
" \"street\": \"中央1丁目7−8\"},\n",
" \"phone\": \"080-3963-3355\",\n",
"}"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"# ここに解答を書く\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"出力例:\n",
"```\n",
"名前: スタートアップ 太郎\n",
"郵便番号: 904-0004\n",
"住所: 沖縄県沖縄市中央1丁目7−8\n",
"電話番号番号: 080-3963-3355\n",
"```"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"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
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment