Day 102itertools.productの活用

2026-06-06 JST ・ 難易度: 中級 ・ カテゴリ: 標準ライブラリ

Pythonコード

1import itertools2 3colors = ['赤', '青', '緑']4shapes = ['丸', '四角', '三角']5 6# itertools.productの使用7combinations = list(itertools.product(colors, shapes))8 9# 結果の表示10for combination in combinations:11    print(combination)

解説

次に試してみよう