1 2 3 4 |
<span class="cm-variable">ruits</span> = {<span class="cm-string">"strawberry"</span>: <span class="cm-string">"red"</span>, <span class="cm-string">"peach"</span>: <span class="cm-string">"pink"</span>, <span class="cm-string">"banana"</span>: <span class="cm-string">"yellow"</span>} <span class="cm-keyword">for</span> <span class="cm-variable">fruit</span>, <span class="cm-variable">color</span> <span class="cm-keyword">in</span> <span class="cm-variable">fruits</span>.<span class="cm-property">items</span>(): <span class="cm-builtin">print</span>(<span class="cm-variable">fruit</span><span class="cm-operator">+</span><span class="cm-string">" is "</span><span class="cm-operator">+</span><span class="cm-variable">color</span>) |
出力結果
1 2 3 |
<span class="cm-variable">strawberry</span> <span class="cm-keyword">is</span> <span class="cm-variable">red</span> <span class="cm-variable">peach</span> <span class="cm-keyword">is</span> <span class="cm-variable">pink</span> <span class="cm-variable">banana</span> <span class="cm-keyword">is</span> <span class="cm-variable">yellow</span> |
コメントを残す