MulaiMulai sekarang secara gratis

Searching for Pokémon

Two Pokémon trainers, Ash and Brock, have a collection of ten Pokémon each. Each trainer's Pokédex (their collection of Pokémon) has been loaded into your session as lists called ash_pokedex and brock_pokedex respectively.

You'd like to see if certain Pokémon are members of either Ash or Brock's Pokédex.

Let's compare using a set versus using a list when performing this membership testing.

Latihan ini adalah bagian dari kursus

Writing Efficient Python Code

Lihat Kursus

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# Convert Brock's Pokédex to a set
brock_pokedex_set = ____
print(brock_pokedex_set)
Edit dan Jalankan Kode