dimanche 11 juillet 2021

How can I make the if function in python try the values from the range for "a" and return the correct answer

a = list(range(0,10))

if a + 6 == 10:
print(a)

I am trying to make the numbers between 0 and 10 be individually substituted into "a" and when it finds the right answer then it will stop and return the value of "a". So in this case just to return 4. I keep getting this error "can only concatenate list (not "int") to list"

Aucun commentaire:

Enregistrer un commentaire