# Python CodeRecipe|inの使い方
❮ Home ❮ Python Keywords
# inの例1
Check if "banana" is present in the list:
fruits = ["apple", "banana", "cherry"]if "banana" in fruits:
print("yes")
# inの定義及び使い方
in関数には2つの目的があります。 in関数は、値が シーケンス内に存在する(リスト、範囲、文字列など。)。 in関数は反復にも使用されます。 forループ内のシーケンスを介して:
# inの例2
Loop through a list and print the items:
fruits = ["apple", "banana", "cherry"]
for x in fruits:
print(x)
❮ Home ❮ Python Keywords