paizaラーニングのレベルアップ問題集「条件分岐メニュー」からの出典です。
paiza.jp
Pythonによる「AND+OR」問題集と、それらの提出コードの解答例です。
僕が作成、提出したコードは、以下のとおりです。
・STEP: 1 AND
/* Pythonによる「条件分岐メニュー」問題集(AND+OR) STEP: 1 AND https://paiza.jp/works/mondai 提出コードの解答例 https://neguse-atama.hatenablog.com */ # coding: utf-8 a,b = input().split(' ') a = int(a) b = int(b) if a >= 10 and b >= 10: print("YES") else: print("NO")
・STEP: 2 大文字判定
/* Pythonによる「条件分岐メニュー」問題集(AND+OR) STEP: 2 大文字判定 https://paiza.jp/works/mondai 提出コードの解答例 https://neguse-atama.hatenablog.com */ # coding: utf-8 str = input() if str.isupper(): print("YES") else: print("NO")
・STEP: 3 OR
/* Pythonによる「条件分岐メニュー」問題集(AND+OR) STEP: 3 OR https://paiza.jp/works/mondai 提出コードの解答例 https://neguse-atama.hatenablog.com */ # coding: utf-8 a,b = input().split(' ') a = int(a) b = int(b) if a >= 10 or b >= 10: print("YES") else: print("NO")
・STEP: 4 NOT
/* Pythonによる「条件分岐メニュー」問題集(AND+OR) STEP: 4 NOT https://paiza.jp/works/mondai 提出コードの解答例 https://neguse-atama.hatenablog.com */ # coding: utf-8 x = int(input()) if not x >= 10: print("YES") else: print("NO")
・STEP: 5 AND+NOT
/* Pythonによる「条件分岐メニュー」問題集(AND+OR) STEP: 5 AND+NOT https://paiza.jp/works/mondai 提出コードの解答例 https://neguse-atama.hatenablog.com */ # coding: utf-8 a,b = input().split(' ') a = int(a) b = int(b) if a >= 10 and not b >= 10: print("YES") else: print("NO")
・FINAL問題: AND+OR
/* Pythonによる「条件分岐メニュー」問題集(AND+OR) FINAL問題: AND+OR https://paiza.jp/works/mondai 提出コードの解答例 https://neguse-atama.hatenablog.com */ # coding: utf-8 x,y,z = input().split(' ') x = int(x) y = int(y) z = int(z) if z >=10: print("YES") else: if x >= 10 and y >= 10: print("YES") else: print("NO")
paizaラーニングのレベルアップ問題集については、ユーザー同士で解答を教え合ったり、コードを公開したりするのは自由としています。
また授業や研修、教材などにも利用できるそうです。