jeudi 17 septembre 2020

Is there an issue in forloops along with if value in list in python?

I am writing a program with forloops to see if a value is in two lists.

gradelist1 = [1, 3, 5]
gradelist2 = [1 ,4,7]
for value in (gradelist1, gradelist2):
    if value in gradelist1 and value in gradelist2:
        print('The value occurs in both the lists')
        break

This is a snippet of that code. is there an issue with it?

Aucun commentaire:

Enregistrer un commentaire