Files
why3/examples/python/check_duplicates.py
paulpatault 3671864507 Python: Added examples
- New examples using the new syntax (+=, ...)
- New examples using the new methods (.pop(), .append(), ...)
- Update old examples with assignement operators (+=, ...)
2021-06-24 11:44:07 +02:00

9 lines
235 B
Python

def check_duplicates(elt, tab):
#@ ensures result == occurrence(elt, tab, 0, len(tab))
nb = 0
for e in tab:
#@ invariant nb == occurrence(elt, tab, 0, e'index)
if e == elt:
nb += 1
return nb