Files
why3/examples/python/even.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

13 lines
261 B
Python

def even (start, stop):
#@ ensures forall i. 0 <= i < len(result) -> result[i] % 2 == 0
step = 0
deb = 0
if start < stop:
step = 2
else:
step = -2
if start % 2 == 0:
deb = start
else:
deb = start + 1
return range(deb, stop, step)