配列の指定した位置の値を削除する Array.removeAt

配列公式データ取得日:2026年11月13日Python:Array.remove_at動作確認待ち

ひとことで言うと

特定の位置にある要素を削除し、その要素を返します。

ブロックとコード

ブロックの文言は公式の日本語版に合わせています(形は簡易表示です)。

引数(ひきすう)

引数とは、ブロックの中で自分で選んだり入力したりする部分のことです。

名前選べる値意味
index数値

使用例

The size of the array shrinks by one. The element is removed from the array at the position you want. All the other elements after it are moved (shifted) to down to the next lower position. So, an array that has the numbers 4, 5, 9, 3, 2 will be 4, 5, 3, 2 if 9 is removed from the array at index 2. It looks like this in blocks:

JavaScript

let myNumbers = [4, 5, 9, 3, 2]
let item = myNumbers.removeAt(2)

Python

myNumbers = [4, 5, 9, 3, 2]
item = myNumbers.remove_at(2)

Remove the most dangerous level of radiation from the list.

JavaScript

let radLevels = ["alpha", "beta", "gamma"]
let level = radLevels.indexOf("gamma")
let unzapped = radLevels.removeAt(level)

Python

radLevels = ["alpha", "beta", "gamma"]
level = radLevels.index_of("gamma")
unzapped = radLevels.remove_at(level)
執筆:鈴木孝昌官公庁のWeb・システム開発を担当する現役プロジェクトマネージャー。マイクラカップ沖縄代表チームを指導(第6回・第7回、第7回TBS賞)。
沖縄マイクラ部で、子どもたちにMakeCodeを教えています。プロフィールと編集方針
Instagramで教室の様子を見る
noteで記事を読む