学習のアウトプットです
まずYesかNoを返す式
print("NYoe s"[1::2])
# Yes
print("NYoe s"[::2])
# No
となるので
1を入れている箇所に真偽判定で1か0を返す値を入れてあげると
YesかNoを返すようになる
そこで下記
print(False)
# False
print(False+0)
# 0
print(True)
# True
print(True+0)
# 1
TrueやFalseはintと混ぜると1や0を返してくれることを利用する
そしてまた下記
print("NYoe s"[judge::2])
judgeの部分に下記の要素を代入すると
# 文字の配列を用意
sampleList=['a', 'i', 'u', 'e', 'o']
# sampleListの配列は文字iを含んでいるか?
print("i" in sampleList)
# True
print("NYoe s"["i" in sampleList::2])
# Yes
この場合
("i" in sampleList)は単体ではTrueかFalseを返すが
judgeの箇所に求められているのはintになるので勝手にint(1か0)に変換される