#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Oct 29 11:37:54 2019 @author: andrea """ # generatori def quadrati_e_cubi(N): for x in range(N): yield x**2 yield x**3 # stile funzionale di programmazione # map, any, all, max, min # esamino tutti gli elementi di un iterabile e controllo se hanno una certa proprietà def sono_tutti_pari(L): for x in L: if not x%2 == 0: return False else: return True def sono_tutti_XXX(L, proprieta): for x in L: if not proprieta(x): return False else: return True