Introduction

This blog shows how can you create a simple stopwatch using Python.
Code:
  1. import os
  2. import time
  3. second = 0
  4. minute = 0
  5. hours = 0
  6. while(True):
  7. print("Simple Stopwatch(in Python) Created By Sourabh Somani...")
  8. print('\n\n\n\n\n\n\n')
  9. print('\t\t\t\t-------------')
  10. print('\t\t\t\t %d : %d : %d '%(hours,minute,second))
  11. print('\t\t\t\t-------------')
  12. time.sleep(1)
  13. second+=1
  14. if(second == 60):
  15. second = 0
  16. minute+=1
  17. if(minute == 60):
  18. minute = 0
  19. hour+=1;
  20. os.system('cls')
Output:
Output