Ibuprofeno.py💊| #128: Explica este código Python

ibuprofeno.py|-#128:-explica-este-codigo-python

Explica este código Python


Dificultad: Intermedio

x = {"a", "b", "c"}
x.remove("x")
print(x)
  • A. {}
  • B. {"a", "b", "c"}
  • C. KeyError
  • D. SyntaxError

Respuesta:

👉 C. KeyError

Para poder eliminar items de un conjunto usamos el método remove().

Si el item a eliminar no existe en el conjunto entonces regresamos un KeyError.

Por ejemplo, para eliminar el item a tendriamos:

x = {"a", "b", "c"}
x.remove("a")
print(x) # {'b', 'c'}

Total
0
Shares
Leave a Reply

Your email address will not be published. Required fields are marked *

Previous Post
top-product-management-reads-in-june

Top product management reads in June

Next Post
what-should-agencies-do-in-a-flat-growth-year?

What Should Agencies Do in a Flat-Growth Year?

Related Posts
役員変更登記

役員変更登記

2025-05-08 申請用総合ソフトで行う アカウントは個人で OK(法人用は特にない) 登記申請書(法人等用)を使う 参考 https://www.touki-kyoutaku-online.moj.go.jp/toukinet/taiken/taiken_zeninjuunin.html https://houmukyoku.moj.go.jp/homu/shogyo_online03.html 法人番号で検索した住所のハイフンが外字扱いだったので、直接入力に切り替えて入力した 電話がかかってきて以下のような文言修正を要求された 添付ファイルに電子署名が必要 議事録の「第 2 号議案:代表理事の重任について」を「第 2 号議案:理事及び代表理事の重任について」 同様に「任期満了に伴い、鈴木健志を理事及び代表理事に再任することを決議した。」 「なお席上就任を承諾した。」の文言を追加。同意書なしのため必要らしい。…
Read More