LoginSignup
0
0

More than 1 year has passed since last update.

はじめに

移植やってます。

pop (Python)

kwa = kw_given.pop()

このkw_givensetっぽいのです。

s から任意の要素を取り除き、それを返します。集合が空の場合、 KeyError を送出します

どうする? (Ruby)

require 'set'

kw_given = (1..5).to_set

kwa = kw_given.first; kw_given.delete(kwa)

Setから任意の要素を取り出すメソッドってあまり無いようです。

firstはEnumerableモジュールのメソッドです。

メモ

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

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