my function is printing passed if the condition becomes successful for the items on the list. if not then it will print failed
list1 = [2,3,4,5,6,7,8,9,10,11,12,13,14,16]
for n in list1:
if 15 > n:
print("passed")
else:
print("failed")
It is giving the correct output. for value 16 in the list1, it is printing failed
Current output:
passed
passed
passed
passed
passed
passed
passed
passed
passed
passed
passed
passed
passed
failed
Is it possible that for value 16 in the list1 also, it should ignore failed and print passed only
Expected output: printing passed for value 16 in the list1
passed
passed
passed
passed
passed
passed
passed
passed
passed
passed
passed
passed
passed
passed
Aucun commentaire:
Enregistrer un commentaire