SlideShare a Scribd company logo
Konno @manmanrai
数学・教育専攻
元中高校生の数学の家庭教師
小学校教育実習済み
フロントエンドエンジニア
データサイエンティストのたまご
本日のメニューは
 アミューズ
 オードブル
 スープ
 ポワソン
 ソルベ
 アントレ
 デセール
 カフェ・ブティフー
本日のメニューは
 アミューズ → インストール
 オードブル → エディタ
 スープ → ターミナル
 ポワソン → データ
 ソルベ → 計算してみよう
 アントレ → 関数(組み込み関数)
 デセール → モジュールと遊んでみよう
 カフェ・ブティフー → ひゅうー
アミューズ(お通し)
インストール
https://www.python.jp/about/
Windowsの方インストールが必要です!
Macデフォルトで入ってます!
Python3推奨
オードブル(前菜)
エディタ
テキストエディタ
画像、イラスト、レイアウトなどデザイン性
高いの書類作成や印刷向けの
ソフトウェアワード(word)とは
少し違って、
テキストエディタ(text editor)とはテキ
ストやプログラムに特化した
ソフトウェア
例えば...
Notepad++
ノートパッドプラスプラス
Sublime
サブライム
Atom
アトム
Visual Studio
Code
PyCharm
パイチャーム
テキストエディタって
インターフェースの使いやすさ、
言語別のパッケージの充実性、
カラーテーマ、アイコンなどデザインの好み、
憧れの先輩が使っているから、
などなど、どんな理由でもいい!
好きなエディタ探してみましょう!
スープ
ターミナル
Terminal
ターミナル
MAC
Command
Prompt
コマンドプロンプト
WINDOWS
PowerShell
パワーシェル
WINDOWS
iTerm2
アイタームツー
ターミナルの基本操作
①ディレクトリの内容を表示する
directory / list
②ディレクトリの移動(変更)する
change directory
cd (同じ階層にある)フォルダ名
cd パス
②−1一個上の階層に戻る
change directory
②−2ルートに戻る
change directory
③フォルダを作る
make directory
mkdir フォルダ名
打ち抜きテスト
desktopに
「first-python」
フォルダを作って
その中に
入ってください
回答例:
$ ls
$ cd desktop
$ mkdir first-python
$ cd first-python
ターミナルの基本操作
クリア
あっ、そういえば、
Pythonのインストールが終わったら
ターミナル上で実行できるんだ
インタープリタ
対話モード
特にpythonファイルに対してなんか操作がなければ、
場所どこでもよいので、ターミナルを開いたら
すぐインタープリタpythonを使える!
$ python
Python 3.6.3 |Anaconda, Inc.| (default, Oct 6 2017, 12:04:38)
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
$から>>>に変わったら、
インタープリタモードに入った証拠!
終了したい時に >>> exit() もしくはctrl + D
何か書いてみようか
>>> 100
>>> python
>>> パイソン
>>> ‘100’
>>> ‘python’
>>> ‘パイソン’
どうな値が返ってきた?
文字列そのまま
書いたら、
なんか怒られた
not defined.
定義されてない
そう、実は
Pythonにデータの形式に関して
決めたルールがあるんです!
ポワソン(魚料理)
データ
整数、小数
文字列
真偽
リスト
整数、小数
数字をそのまま書く
小数点が必要な場合は小数点を付ける
簡単だな
2940
17.35
文字列
文字を引用符で囲む
Pythonの世界では’文字’と”文字”は同じ意味
囲んだら
簡単だな
“Python”
‘PyLadies’
真偽
True、False
この2つしかない めっちゃ
シンプル
True
False
リスト
カンマ区切りに並べた
データを角括弧で囲む
データって
さっきの仲間たちの
ことだよ
[True, False]
[130.2 , ‘text’, ‘today’]
インタープリタで
4種類のデータを送ってみてください!
ソルベ(口直し)
計算してみよう
電卓として使ってみましょう!
足し算
引き算
掛け算
割り算
電卓として使ってみましょう!
5を2で割った時の余り
5の2乗
四則演算と同じ、
足し算、引き算より、
掛け算と割り算を先に実行する
電卓として使ってみましょう!
1. 72を13で割った時の余り
2. 37の3乗
色々試してみて!遊んでみて!
今月の家計簿の試算とか
整数と文字列を演算子で繋げようとすると、、?
例えば、
>>> 366 + ‘days’
整数と文字列を演算子で繋げようとすると、、?
怒られた!
エラーメッセージを確認してみましょう!
int 整数と str 文字列には足し算使えません!
整数と文字列を演算子で繋げようとすると、、?
文字列に変換したら、できました!
アントレ(お肉料理)
関数(組み込み関数)
Tea ? Coffee ? Or me?
len() str() print()
len()
フルネーム:length
機能:文字列の長さを測る
使用例:
>>> len(‘Pyladies’)
>>> len(‘684903’)
str()
フルネーム:string
機能:データを文字列に変換す
る
使用例:
>>> str(4892)
>>> str([‘pig’, ‘pigs’])
print()
フルネーム:print
機能:データを画面に出力
する
>>> text = ‘pyLadies’
>>> print(text)
デセール(デザート)
モジュールと遊んでみよう
モジュールとは?
「部品」みたいなものです。
組み込みデータではない
データ型を使う時に
モジュールを呼び出してから
使えるようになるもの!
例で言うと
>>> import datetime
>>> today = datetime.date.today()
>>> print(today)
書くと、どんな値が返ってきた?
datetimeというモジュールをimportして
その中のdate(ある1日を表現)の
その中のtoday()関数を使って、
今日の日付を取得する、
最後にprint()関数で出力する
では、自分の人生を計算してみましょうか。
生まれた日から
何日経ったんでしょう。
Step by step
Step 1.
大事なモジュールをインポートする
Step 2.
今日の日付をゲットする
Step 3.
自分の誕生日をモジュール内のデータ型に嵌め込む
Step 4.
(引き算)計算する
Step 5.
引き算した結果をプリントアウトする
Step 1.
大事なモジュールをインポートする
>>> import datetime
Step 2.
今日の日付をゲットする
>>> import datetime
>>> today = datetime.date.today()
Step 3.
自分の誕生日をモジュール内のデータ型に嵌め込む
>>> import datetime
>>> today = datetime.date.today()
>>> birthday = datetime.date(1934, 12, 6)
Step 4.
(引き算)計算する
>>> import datetime
>>> today = datetime.date.today()
>>> birthday = datetime.date(1934, 12, 6)
>>> life = today - birthday
Step 5.
引き算した結果をプリントアウトする
>>> import datetime
>>> today = datetime.date.today()
>>> birthday = datetime.date(1934, 12, 6)
>>> life = today - birthday
>>> print(life)
カフェ・ブティフー(コーヒーと小菓子)
ひゅー
これから何回の使いたいであれば、
毎回インタープリタ上で一行一行書くの大変なの
で、どうしたらよいですか?
>>> import datetime
>>> today = datetime.date.today()
>>> birthday = datetime.date(1934, 12, 6)
>>> life = today - birthday
>>> print(life)
import datetime
today = datetime.date.today()
birthday = datetime.date(1934, 12, 6)
life = today - birthday
print(life)
エディタで新規ファイルを開いてコードを入れてlife.pyとして保
存して
場所は一番最初に作ったフォルダに
desktop/first-python/
現在のターミナルで
Pythonインタープリタモードを終了する
終了方法は2つ:
① >>> exit()
② ctrl + D
現在どの階層にいるかを確認しましょう!
(復習)ゴール:desktop/first-python/
first-python User $
ディレクトリの内容を表示するコマンド打って
先ほど作ったファイルlife.py見つけたら大丈夫です!
$ python life.py
最後に勇気を持って、
$ python life.py
実行してみましょう!
みなさま
お腹いっぱいになりましたか?
         最後までお付き合い頂き 
           誠にありがとうございました!

More Related Content

Recently uploaded

Generating Automatic Feedback on UI Mockups with Large Language Models
Generating Automatic Feedback on UI Mockups with Large Language ModelsGenerating Automatic Feedback on UI Mockups with Large Language Models
Generating Automatic Feedback on UI Mockups with Large Language Models
harmonylab
 
キンドリル ネットワークアセスメントサービスご紹介 今のネットワーク環境は大丈夫? 調査〜対策までご支援します
キンドリル ネットワークアセスメントサービスご紹介 今のネットワーク環境は大丈夫? 調査〜対策までご支援しますキンドリル ネットワークアセスメントサービスご紹介 今のネットワーク環境は大丈夫? 調査〜対策までご支援します
キンドリル ネットワークアセスメントサービスご紹介 今のネットワーク環境は大丈夫? 調査〜対策までご支援します
Takayuki Nakayama
 
This is the company presentation material of RIZAP Technologies, Inc.
This is the company presentation material of RIZAP Technologies, Inc.This is the company presentation material of RIZAP Technologies, Inc.
This is the company presentation material of RIZAP Technologies, Inc.
chiefujita1
 
遺伝的アルゴリズムと知識蒸留による大規模言語モデル(LLM)の学習とハイパーパラメータ最適化
遺伝的アルゴリズムと知識蒸留による大規模言語モデル(LLM)の学習とハイパーパラメータ最適化遺伝的アルゴリズムと知識蒸留による大規模言語モデル(LLM)の学習とハイパーパラメータ最適化
遺伝的アルゴリズムと知識蒸留による大規模言語モデル(LLM)の学習とハイパーパラメータ最適化
t m
 
LoRaWAN 4チャンネル電流センサー・コンバーター CS01-LB 日本語マニュアル
LoRaWAN 4チャンネル電流センサー・コンバーター CS01-LB 日本語マニュアルLoRaWAN 4チャンネル電流センサー・コンバーター CS01-LB 日本語マニュアル
LoRaWAN 4チャンネル電流センサー・コンバーター CS01-LB 日本語マニュアル
CRI Japan, Inc.
 
論文紹介:Deep Learning-Based Human Pose Estimation: A Survey
論文紹介:Deep Learning-Based Human Pose Estimation: A Survey論文紹介:Deep Learning-Based Human Pose Estimation: A Survey
論文紹介:Deep Learning-Based Human Pose Estimation: A Survey
Toru Tamaki
 
JSAI_類似画像マッチングによる器への印象付与手法の妥当性検証_ver.3_高橋りさ
JSAI_類似画像マッチングによる器への印象付与手法の妥当性検証_ver.3_高橋りさJSAI_類似画像マッチングによる器への印象付与手法の妥当性検証_ver.3_高橋りさ
JSAI_類似画像マッチングによる器への印象付与手法の妥当性検証_ver.3_高橋りさ
0207sukipio
 
ReonHata_便利の副作用に気づかせるための発想支援手法の評価---行為の増減の提示による気づきへの影響---
ReonHata_便利の副作用に気づかせるための発想支援手法の評価---行為の増減の提示による気づきへの影響---ReonHata_便利の副作用に気づかせるための発想支援手法の評価---行為の増減の提示による気づきへの影響---
ReonHata_便利の副作用に気づかせるための発想支援手法の評価---行為の増減の提示による気づきへの影響---
Matsushita Laboratory
 

Recently uploaded (8)

Generating Automatic Feedback on UI Mockups with Large Language Models
Generating Automatic Feedback on UI Mockups with Large Language ModelsGenerating Automatic Feedback on UI Mockups with Large Language Models
Generating Automatic Feedback on UI Mockups with Large Language Models
 
キンドリル ネットワークアセスメントサービスご紹介 今のネットワーク環境は大丈夫? 調査〜対策までご支援します
キンドリル ネットワークアセスメントサービスご紹介 今のネットワーク環境は大丈夫? 調査〜対策までご支援しますキンドリル ネットワークアセスメントサービスご紹介 今のネットワーク環境は大丈夫? 調査〜対策までご支援します
キンドリル ネットワークアセスメントサービスご紹介 今のネットワーク環境は大丈夫? 調査〜対策までご支援します
 
This is the company presentation material of RIZAP Technologies, Inc.
This is the company presentation material of RIZAP Technologies, Inc.This is the company presentation material of RIZAP Technologies, Inc.
This is the company presentation material of RIZAP Technologies, Inc.
 
遺伝的アルゴリズムと知識蒸留による大規模言語モデル(LLM)の学習とハイパーパラメータ最適化
遺伝的アルゴリズムと知識蒸留による大規模言語モデル(LLM)の学習とハイパーパラメータ最適化遺伝的アルゴリズムと知識蒸留による大規模言語モデル(LLM)の学習とハイパーパラメータ最適化
遺伝的アルゴリズムと知識蒸留による大規模言語モデル(LLM)の学習とハイパーパラメータ最適化
 
LoRaWAN 4チャンネル電流センサー・コンバーター CS01-LB 日本語マニュアル
LoRaWAN 4チャンネル電流センサー・コンバーター CS01-LB 日本語マニュアルLoRaWAN 4チャンネル電流センサー・コンバーター CS01-LB 日本語マニュアル
LoRaWAN 4チャンネル電流センサー・コンバーター CS01-LB 日本語マニュアル
 
論文紹介:Deep Learning-Based Human Pose Estimation: A Survey
論文紹介:Deep Learning-Based Human Pose Estimation: A Survey論文紹介:Deep Learning-Based Human Pose Estimation: A Survey
論文紹介:Deep Learning-Based Human Pose Estimation: A Survey
 
JSAI_類似画像マッチングによる器への印象付与手法の妥当性検証_ver.3_高橋りさ
JSAI_類似画像マッチングによる器への印象付与手法の妥当性検証_ver.3_高橋りさJSAI_類似画像マッチングによる器への印象付与手法の妥当性検証_ver.3_高橋りさ
JSAI_類似画像マッチングによる器への印象付与手法の妥当性検証_ver.3_高橋りさ
 
ReonHata_便利の副作用に気づかせるための発想支援手法の評価---行為の増減の提示による気づきへの影響---
ReonHata_便利の副作用に気づかせるための発想支援手法の評価---行為の増減の提示による気づきへの影響---ReonHata_便利の副作用に気づかせるための発想支援手法の評価---行為の増減の提示による気づきへの影響---
ReonHata_便利の副作用に気づかせるための発想支援手法の評価---行為の増減の提示による気づきへの影響---
 

Featured

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
Skeleton Technologies
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
Christy Abraham Joy
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
Vit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
MindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
GetSmarter
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
Alireza Esmikhani
 

Featured (20)

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 

[Hands on Python] 20180422 PyLadies Tokyo Meetup #31 Python入学式