LoginSignup
0
0

【Paiza問題集】条件分岐/AND+OR

Posted at

Paiza問題集

Pythonで回答

条件分岐/AND+OR

Step01 AND

"""
AND
https://paiza.jp/works/mondai/conditions_branch/conditions_branch__bool_step1

問題
2つの整数A、Bが与えられます
AとBが両方とも10以上の場合はYESを、そうではない場合はNOを出力してください
"""

A, B = map(int, (input().split()))
print("YES" if A >= 10 and B >= 10 else "NO")

Step02 大文字判定

"""
大文字判定
https://paiza.jp/works/mondai/conditions_branch/conditions_branch__bool_step2

問題
大文字または小文字のアルファベットCが与えられます
Cが大文字の場合はYESを、そうではない場合はNOを出力してください
"""

print("YES" if input().isupper() else "NO")

Step03 OR

"""
OR
https://paiza.jp/works/mondai/conditions_branch/conditions_branch__bool_step3

問題
2つの整数A、Bが与えられます
A,Bの少なくとも一方が10以上の場合はYESを、そうではない場合はNOを出力してください
"""

A, B =map(int, input().split())
print("YES" if A >= 10 or B >= 10 else "NO")

Step04 NOT

"""
NOT
https://paiza.jp/works/mondai/conditions_branch/conditions_branch__bool_step4

問題
整数Xが与えられます
Xが10以上ではない場合はYESを、Xが10以上である場合はNOを出力してください
"""

print("YES" if not int(input())>=10 else "NO")

Step05 AND+NOT

"""
AND+NOT
https://paiza.jp/works/mondai/conditions_branch/conditions_branch__bool_step5

問題
2つの整数A、Bが与えられます
以下の条件を満たす場合はYESを、そうではない場合はNOを出力してください。
「Aが10以上」かつ「Bが10以上ではない」
"""

A, B = map(int, input().split())
print("YES" if (A>=10) and (not B >=10) else"NO")

Final問題集 AND+OR

"""
AND+OR

問題
3つの整数X,Y,Zが与えられます
「Xが10以上」かつ「Yが10以上」の場合はYESを、そうではない場合はNOを出力してください
ただし、「Zが10以上の」場合はXとYの値にかかわらず、必ずYESを出力してください
"""

X, Y, Z = map(int, input().split())

if Z >= 10:
    print("YES")
else:
    print("YES" if X>=10 and Y>=10 else "NO")
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