Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ cat test.py
- import time
- def bar():
- c = 0
- while True:
- c += 1
- time.sleep(1)
- print(1 / (c - 20))
- def foo():
- bar()
- foo()
- $ python test.py &
- $ rm test.py
- -0.07692307692307693
- -0.08333333333333333
- -0.09090909090909091
- -0.1
- -0.1111111111111111
- -0.125
- -0.14285714285714285
- -0.16666666666666666
- -0.2
- -0.25
- -0.3333333333333333
- -0.5
- -1.0
- Traceback (most recent call last):
- File "test.py", line 16, in <module>
- File "test.py", line 13, in foo
- File "test.py", line 9, in bar
- ZeroDivisionError: division by zero
- [1]+ Exit 1 python test.py
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement