金子邦彦研究室プログラム例とヒントプログラミング入門とオンライン開発環境Python, Java, C プログラミングの体験(Python Tutor を使用)

Python, Java, C プログラミングの体験(Python Tutor を使用)

Python Tutor での実行結果例

PythonTutor は,Python 3, Java, C, C++, JavaScript, Ruby に対応.オブジェクトの表示,ステップ実行がビジュアルに簡単にできる.

URL: http://www.pythontutor.com/

※ お断り

特定の商用製品等を推奨、広報するものではない.使用感など評価を行うものでもない. 操作手順等について記述している

Python, Java, C プログラミングの体験(Python Tutor を使用)

  1. Web ページを開く

    http://www.pythontutor.com/

  2. 言語に応じて,サービスを選ぶ

    [image]

    「Python Tutor」を選んだとして説明を続ける

  3. プログラミング言語が表示されるので確認する

    [image]
  4. エディタでプログラムを編集し, 「Visual Execution」をクリック

    [image]
  5. 画面が変わる.最後まで実行したいので「Last」をクリック

    [image]
  6. 実行結果が表示されるので確認

    [image]
  7. エディタの画面に戻るには,「Edit this code」をクリック

    [image]

Python 3, Java, C の実行結果例

Python 3

Python Tutor による

x = [5, 4, 1, 3, 2]
for i in x:
    print(i * 120)

[image]

Java

Java Tutor による

public class Main {
    public static void main(String[] args) throws Exception {
        int x[] = {5, 4, 1, 3, 2};
        for (int i = 0; i < x.length; i++ ) {
            System.out.println(x[i]);
        }
    }
}

[image]

C

#include<stdio.h>
int main(void){
    int i;
    int x[] = {5, 4, 1, 3, 2};
    for(i = 0; i < (sizeof(x)/sizeof(int)); i++) {
        printf("%d\n", x[i] * 120);
    }
}

[image]