0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

ロッチ「言わんといて」の条件分岐

Last updated at Posted at 2025-04-30

はじめに

ロッチの「言わんといて」というコントが面白すぎて何度か見返していたのですが、コカドさんのために中岡さんの言っていることを整理してあげたくなったのでプログラムにしてみました。

面白いのでコント動画ぜひ見てほしいです。
if文を勉強したての人には動画内のコカドさんの苦悩に共感できるとおもいます。

中岡さんに「言う」べきか判定する

def should_notify_nakaoka(is_cancelled: bool,
                          hanshin: list,
                          x: list):
  if is_cancelled: #雨天中止の場合
    return True  #言う
  if sum(hanshin) > sum(x): #阪神が勝った場合
    return False #言わない
  if sum(x) - sum(hanshin) >= 10: #10点以上差をつけられている場合
    if sum(hanshin[:8]) + sum(x[:8]) == 0: #1回から8回まで0対0の場合
      return False #言わない
    else:
      return True  #言う
  if x[0] - hanshin[0] >= 7: #初回に7点差以上
    return True  #言う
    
  return False

おわりに

テストが不充分なので不安が残りますが、これで少しはコカドさんの助けになるでしょうか、、
どうせ試合を重ねるごとに中岡さんの要件は増え続けていくんでしょうね

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?