Feb-20-2018, 01:24 AM
first, you need to import "time". Never use keywords or module names as variables. You need to indent correctly (in Python, that is four spaces). Finally, you need to "call" your function.
import time def mycounter(lapse): count = 0 for x in range(1, lapse): print(count) count = count + 1 time.sleep(1) if count == lapse: count = 0 mycounter(10)
Output:0
1
2
3
4
5
6
7
8
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition