Advertisement
Guest User

Untitled

a guest
Jan 7th, 2021
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. $ cat test.py
  2. import time
  3.  
  4.  
  5. def bar():
  6. c = 0
  7. while True:
  8. c += 1
  9. time.sleep(1)
  10. print(1 / (c - 20))
  11.  
  12.  
  13. def foo():
  14. bar()
  15.  
  16.  
  17. foo()
  18.  
  19. $ python test.py &
  20. $ rm test.py
  21. -0.07692307692307693
  22. -0.08333333333333333
  23. -0.09090909090909091
  24. -0.1
  25. -0.1111111111111111
  26. -0.125
  27. -0.14285714285714285
  28. -0.16666666666666666
  29. -0.2
  30. -0.25
  31. -0.3333333333333333
  32. -0.5
  33. -1.0
  34. Traceback (most recent call last):
  35. File "test.py", line 16, in <module>
  36. File "test.py", line 13, in foo
  37. File "test.py", line 9, in bar
  38. ZeroDivisionError: division by zero
  39.  
  40. [1]+ Exit 1 python test.py
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement