One aspect of programming that many tutorials don’t tell you upfront is the amount of looping and counting you’ll have to do. As such, any programming language worth its salt will offer ways to ...
range関数は、指定した範囲の整数のシーケンス生成に使用されます。 range関数は、start, stop, stepの3つの引数を受け取ります。 各引数の説明を下記に記載します。 start: シーケンスの開始値(デフォルトは0) stop: シーケンスの終了値(stopの直前の値まで生成 ...
急に重箱の隅を突くような話になってしまいますがPythonとRubyでrangeオブジェクトの動きが面白いなと思ったのでメモ。前回の投稿でも入れようかと思ったんですが長くなってしまったので別稿で。 PythonとRubyでrangeクラスのオブジェクトを作るとこんな感じ。
"for(int i = 0; i < x; i ++){}". Compiled by gcc with -O2 option, we can get completely same object code from both of the above.