:は「および/または」場合ネストされたリストを作成し、さらにアクションを行うために、「または」と「と」の条件の両方が適用され、私は、コードに取り組んでいます文
a= ["john", "carlos", "22", "70"]
if (("qjohn" or "carlos") in a) and (("272" or "70") in a):
print "true"
else:
print "not true"
出力:
をnot true
私はこれを実行します。
a= ["john", "carlos", "22", "70"]
if ("qjohn" or "cdarlos" in a) and ("272" or "d70" in a):
print "true"
else:
print "not true"
出力は"true"
**carlos and 70**
は真であるべきですが、それは「真実ではありません」と表示されます。このエラーの原因は何ですか?ありがとう
ない、非常にだまされやすい人と同じですが、同じ基本的な問題と情報:[どのように私は、複数の値に対して一つの変数をテストするのですか? ](https://stackoverflow.com/questions/15112125/how-do-i-test-one-variable-against-multiple-values) – glibdud