LoginSignup
0
0

More than 3 years have passed since last update.

【Python学習中】 ピーマン嫌いな人の強がり if/for/else/continue/format

Last updated at Posted at 2020-08-12

子どもの頃からピーマンがあまり好きではないので。。。
ピーマンを食べずに済むコードを書きながら、Pythonの基本文法の練習です。

green_pepper.py

for vegitable in ['carrot', 'green pepper', 'lettuce', 'onion', 'garlic']:
    if vegitable == 'green pepper':
        continue
    print(f"I ate {vegitable}.")
else:
    print('I love vegitables!')

I ate carrot.
I ate lettuce.
I ate onion.
I ate garlic.
I love vegitable!
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