Python プログラミングの基本(Python Tutor,VisuAlgo を使用)(スライド資料とプログラム例)(全9回)
オンラインのPython Tutor (http://pythontutor.com) , VisuAlgo (https://visualgo.net/ja) を使用
【目次】
- po-1. プログラミング入門 [PDF], [パワーポイント], [スライド HTML]
トピックス:GDB online, Java プログラム実行
- po-2. Python プログラミングの基本 [PDF], [パワーポイント], [スライド HTML]
トピックス:計算, 変数, 代入, キーボードからの読み取り, 表示
- po-3. 式の抽象化と関数 [PDF], [パワーポイント], [スライド HTML]
トピックス:条件分岐, if, else, 比較演算
- po-4. 条件分岐,ステップ実行 [PDF], [パワーポイント], [スライド HTML]
- po-5. リスト,辞書 [PDF], [パワーポイント], [スライド HTML]
- po-6. 繰り返し実行(ループ),ステップ実行 [PDF], [パワーポイント], [スライド HTML]
- po-7. モジュール,標準ライブラリ,算法(アルゴリズム) [PDF], [パワーポイント], [スライド HTML]
- po-8. クラス,メソッド,オブジェクト生成 [PDF], [パワーポイント], [スライド HTML]
- po-9. クラス階層,継承 [PDF], [パワーポイント], [HTML]
【関連するオンラインサービス】
- PythonTutor のURL:http://www.pythontutor.com/
- VisuAlgo のURL:https://visualgo.net
【外部ページへのリンク(Python 関連)】
- 東京大学の「Pythonプログラミング入門」: https://utokyo-ipp.github.io/IPP_textbook.pdf
- ITmedia 社の「Python チートシート」の記事: https://atmarkit.itmedia.co.jp/ait/articles/2004/20/news015.html
- Python の公式サイト: https://www.python.org
【サイト内の関連ページ】
- Python まとめページ: 別ページ »にまとめ
- Python 入門: 別ページ »にまとめ
- Python プログラム例: 別ページ »にまとめ
- 人工知能の実行(Google Colaboratory を使用): 別ページ »にまとめ
- 人工知能の実行(Python を使用): 別ページ »にまとめ
- オンラインプログラミング環境のガイド
【Python のインストール】
1. プログラミング入門
資料:po-1. プログラミング入門 [PDF], [パワーポイント], [スライド HTML]
トピックス:Python, プログラミング, Python Tutur, Python Tutor での Python プログラム実行, プログラムによる問題解決, 計算誤差, さまざまなプログラミング言語
2. Python プログラミングの基本
資料:po-2. Python プログラミングの基本 [PDF], [パワーポイント], [スライド HTML]
トピックス:Python, プログラミング, 式, 変数, オブジェクト, メソッド, 引数, 代入, データの種類, 制御, 条件分岐, 繰り返し, コードコンバット(Code Combat)
3. 式の抽象化と関数
資料:po-3. 式の抽象化と関数 [PDF], [パワーポイント], [スライド HTML]
トピックス:Python, プログラミング, Python Tutor, 式, 変数, 式の抽象化, 関数, 関数定義, def, 関数呼び出し
4. 条件分岐,ステップ実行
資料:po-4. 条件分岐,ステップ実行 [PDF], [パワーポイント], [スライド HTML]
トピックス:Python, プログラミング, Python Tutor, 条件分岐, if, else, ステップ実行
5. リスト,辞書
資料:po-5. リスト,辞書 [PDF], [パワーポイント], [スライド HTML]
トピックス:Python, プログラミング, Python Tutor,リスト, 辞書
6. 繰り返し実行(ループ),ステップ実行
資料:po-6. 繰り返し実行(ループ),ステップ実行 [PDF], [パワーポイント], [スライド HTML]
トピックス:Python, プログラミング, Python Tutor, 繰り返し, for, in, ステップ実行
7. モジュール,標準ライブラリ,算法(アルゴリズム)
資料:po-7. モジュール,標準ライブラリ,算法(アルゴリズム) [PDF], [パワーポイント], [スライド HTML]
トピックス:Python, プログラミング, Python Tutor, モジュール, インポート, import, サブモジュール, パッケージ, 標準ライブラリ, 算法, アルゴリズム
8. クラス,メソッド,オブジェクト生成
資料:po-8. クラス,メソッド,オブジェクト生成 [PDF], [パワーポイント], [スライド HTML]
トピックス:Python, プログラミング, Python Tutor, クラス, class, def, __init__, オブジェクト, クラス定義, メソッド, self, オブジェクト生成, メソッドアクセス, 属性アクセス
資料中のソースコード 8-2
class Ball:
def __init__(self, x, y, r, color):
self.x = x
self.y = y
self.r = r
self.color = color
def printout(self):
print(self.x, self.y, self.r, self.color)
a = Ball(8, 10, 1, "blue")
b = Ball(2, 4, 3, "green")
a.printout()
b.printout()
資料中のソースコード 8-3
class Ball:
def __init__(self, x, y, r, color):
self.x = x
self.y = y
self.r = r
self.color = color
def printout(self):
print(self.x, self.y, self.r, self.color)
def dist(self):
return self.x + self.y
a = Ball(8, 10, 1, "blue")
b = Ball(2, 4, 3, "green")
a.printout()
b.printout()
print(a.dist())
資料中のソースコード 8-4
class Ball:
def __init__(self, x, y, r, color):
self.x = x
self.y = y
self.r = r
self.color = color
def printout(self):
print(self.x, self.y, self.r, self.color)
def dist(self):
return self.x + self.y
def move(self, xx, yy):
self.x = self.x + xx;
self.y = self.y + yy;
a = Ball(8, 10, 1, "blue")
b = Ball(2, 4, 3, "green")
a.move(5, 5)
b.move(10, 10)
a.printout()
b.printout()
print(a.dist())
資料中のソースコード 8-4
class Ball:
def __init__(self, x, y, r, color):
self.x = x
self.y = y
self.r = r
self.color = color
def printout(self):
print(self.x, self.y, self.r, self.color)
def dist(self):
return self.x + self.y
def move(self, xx, yy):
self.x = self.x + xx;
self.y = self.y + yy;
def right(self, xx):
self.move(xx, 0)
def left(self, xx):
self.move(-xx, 0)
a = Ball(8, 10, 1, "blue")
b = Ball(2, 4, 3, "green")
a.move(5, 5)
b.move(10, 10)
a.right(5)
b.left(10)
a.printout()
b.printout()
print(a.dist())
9. クラス階層,継承
資料:po-9. クラス階層,継承 [PDF], [パワーポイント], [HTML]
トピックス:Python, プログラミング, Python Tutor, クラス定義, メソッド, クラス階層, 継承, super, dir
資料中のソースコード
class Point:
def __init__(self, x, y, color):
self.x = x
self.y = y
self.color = color
def printout(self):
print(self.x, self.y, self.color)
class Ball(Point):
def __init__(self, x, y, r, color):
super(Ball, self).__init__(x, y, color)
self.r = r
def printout(self):
print(self.x, self.y, self.r, self.color)
p = Point(1, 2, "red")
p.printout()
a = Ball(8, 10, 1, "blue")
b = Ball(2, 4, 3, "green")
a.printout()
b.printout()
class Point:
def __init__(self, x, y, color):
self.x = x
self.y = y
self.color = color
def printout(self):
print(self.x, self.y, self.color)
def reset(self):
self.x = 0
self.y = 0
class Ball(Point):
def __init__(self, x, y, r, color):
super(Ball, self).__init__(x, y, color)
self.r = r
def printout(self):
print(self.x, self.y, self.r, self.color)
p = Point(1, 2, "red")
p.printout()
a = Ball(8, 10, 1, "blue")
b = Ball(2, 4, 3, "green")
a.reset()
b.reset()
a.printout()
b.printout()
関連動画
