mercredi 15 juin 2016

Python : What is the purpose of a colon in an if statement?

I have this piece of python code below.

def m(list):
    v = list[0]
    for e in list:
      if v < e: v = e
    return v

values = [[3, 4, 5, 1], [33, 6, 1, 2]]

for row in values: 
    print(m(row), end = " ")

The result is 5, 33.

Can somebody explain me that following if statement if v < e: v = e?

Aucun commentaire:

Enregistrer un commentaire