enumerate() は「番号も一緒に欲しい」を自然に書ける道具 Pythonでリストを for で回すのに慣れてくると、次に出てくる悩みが「いま何番目?」というやつ。 たとえば買い物リストを表示するとき、ただ品名が並ぶより「1. 牛乳」「2. 卵」みたいに番号が付いて ...
CTC教育サービスはコラム「ゼロから歩くPythonの道> 第71回 Pythonのインデックスの考えと、ループ処理を簡単にするenumerate()」を公開しました。 こんにちは、吉政創成 菱沼です。 今回も「きれいなPythonプログラミング(マイナビ出版)」という書籍を利用し ...
みなさん、こんにちは。最近朝型の生活に戻りつつあります、Triaezuです。 今回はpythonの勉強を始めて3週間後に出会うような関数2つを紹介します。私は機械学習に興味を持ってpythonを始めたのですが、最初は入門本を買わずにPyQというサービスにライト ...
The Python programming language offers a wide range of built-in functions that simplify code and make it easier to manipulate data. One such function is the enumerate() function, which allows you to ...
What comes to your mind when you hear the word `zip`? A mechanism extensively used to tie two parts of something, e.g. shirt or jacket. Python's `zip()` functions does pretty much the same, it helps ...