0
0

More than 1 year has passed since last update.

paizaラーニング「配列に含まれている? 1 Python3編」

Posted at

私の解答

a = [10, 13, 21, 1, 6, 51, 10, 8, 15, 6]
b = 0

for i in a:
    if i == 6:
        b = b + 1
if b >= 1:
    print("Yes")
else:
    print("No")

解答例

li = [10, 13, 21, 1, 6, 51, 10, 8, 15, 6]
output = False

for ele in li:
    if ele == 6:
        print("Yes")
        output = True
        break

if not output:
    print("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