0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Python to RubyAdvent Calendar 2021

Day 18

[py2rb] insert

Last updated at Posted at 2021-12-20

はじめに

移植やってます

insert (Python)

parsed_sequence.insert(0, nterm)

リストの0番目にntermを挿入します。
今回は先頭に追加の意味になります。

unshift (Ruby)

parsed_sequence.unshift(nterm)

0番目以外だと大変でした。
[追記]
コメント欄にて教えていただいたのですが、rubyにもinsertありました。

parsed_sequence.insert(0, nterm)

@obelisk68 さん、ありがとうございました。

メモ

  • Python の insert を学習した
  • 道のりは遠そう
0
0
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?