lundi 24 juin 2019

How can I create an if loop that only runs if a variable is iterable?

I want to make a simple if statement that checks if a variable is iterable and if the variable is iterable then something will print out. I have posted my code below but it's not working:

numbersList = [1,2,3,4,5,6,7]
if iterable(numbersList) = True:
    print("success")

Aucun commentaire:

Enregistrer un commentaire