Funzioni

def is_leap(year):
    leap = False
    
    if (year%4==0 and year%100!=0) or year%400==0:
        leap = True
  
    return leap

anno = 1964
anno = int(input("Scrivi un anno nel formato <aaaa> e premi invio"))
res = is_leap(anno)
if res:
    print("L'anno è bisestile")
else:
    print("L'anno non è bisestile")

Esempio di come scrivere una funzione (is_leap) in Python.

In questo caso la funzione calcola se l’anno passato come argomento sia bisestile o no.