ray88’s diary

お仕事で困ったとき用の自分用の覚書

Python If文 Or条件

サンプルコード

#random モジュールのrandit関数を読込
from random import randint
# 0~100の乱数
size = randint(5,20)
weight = randint(20,40)
#判定(どちらか片方でもTrueなら合格)
if (size >= 10) or (weight >=25):
        result = "合格"
else:
    result = "不合格"
#If文終わり
#結果の出力
text = f"サイズ{size},重量{weight}:{result}"
print(text)

出力結果1

出力結果2