Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #RICORSIONE: Si definisca una funzione ricorsiva che, data una lista L, un valore V e un intero k, restituisce true se il valore V è #presente in tutte le posizioni della lista il cui indice è multiplo di k, e false altrimenti.
- def findV(L,v,k):
- # @param L: list;
- # @param v: T
- # @param k. int;
- # @return bool
- if len(L)==0:
- return false
- elif len(L)<k:
- return true
- else:
- return L[0]==v and findV(L[k:],v,k)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement