![](https://tgfile.tg-static.com/static/web/img/placeholder.gif)
ノンプロ研初心者向けプログラミング講座第5期【Python コース】第2回
![](https://tgfile.tg-static.com/static/web/img/placeholder.gif)
今日は #ノンプロ研 Python初心者講座第2回です~ 内容は、制御構文・関数です。 pic.twitter.com/vsJVwUFNNv
2021-04-26 19:51:23![](https://tgfile.tg-static.com/static/web/img/placeholder.gif)
![](https://tgfile.tg-static.com/static/web/img/placeholder.gif)
Pythonはインデントちゃんとしないと動かないとかある #ノンプロ研
2021-04-26 20:13:17![](https://tgfile.tg-static.com/static/web/img/placeholder.gif)
【質問】ifのあとのコロンの意味 python.keicode.com/lang/control-b… @ID_HelpDesk #ノンプロ研
2021-04-26 20:17:41![](https://tgfile.tg-static.com/static/web/img/placeholder.gif)
if 文による条件分岐は if 条件式: 処理 条件式の後のコロンと処理のインデントが大事 #ノンプロ研
2021-04-26 20:18:47![](https://tgfile.tg-static.com/static/web/img/placeholder.gif)
条件分岐 if a > b: return a else: return b インデントしないとエラーになります。 #ノンプロ研
2021-04-26 20:21:06![](https://tgfile.tg-static.com/static/web/img/placeholder.gif)
インデントのスペースは4つにしましょう! スペース2つとかでも実は動きます。 スペースは4つの理由はPEP8にそう書いてるから? python.ms/pep7/#%E3%81%A… #ノンプロ研
2021-04-26 20:24:48![](https://tgfile.tg-static.com/static/web/img/placeholder.gif)
インデントを、戻せばIF文から抜けられる #ノンプロ研
2021-04-26 20:24:50![](https://tgfile.tg-static.com/static/web/img/placeholder.gif)
VSCodeで実施している場合はタブでスペースいくつ分開けるか設定できます。 atmarkit.co.jp/ait/articles/1… #ノンプロ研 twitter.com/plumfield56/st…
2021-04-26 20:26:53![](https://tgfile.tg-static.com/static/web/img/placeholder.gif)
PEP8で載っているインデント箇所はこちら pep8-ja.readthedocs.io/ja/latest/#id6 4つスペースの場合も気を付けましょう。 個人的にはPEP8に関わらずリーダブルなコードは正義です。 #ノンプロ研
2021-04-26 20:29:14![](https://tgfile.tg-static.com/static/web/img/placeholder.gif)
if 式1: 「式1」が真のときにのみ実行される elif 式2: 「式1」が偽 かつ「式2」が真のときにのみ実行される elif 式3: 「式1」「式2」が偽 かつ「式3」が真のときにのみ実行される else: 「式1」「式2」「式3」がいずれも偽のときにのみ実行される #ノンプロ研
2021-04-26 20:29:50