lundi 24 décembre 2018

When to use If If over an If Elif in Python

Does someone have a simple answer as to why you would use a If If rather than an If Elif?

Example:

def fun(item):
    if item[0]<'M':
        return 0
    if item[0]<'Q':
        return 1
    return 2

Aucun commentaire:

Enregistrer un commentaire