time module (sleep, perf_counter)
Në shqip: Moduli time
ShpjegimiSQ
time.sleep(2) e ndal programin për 2 sekonda, dhe time.perf_counter() mat sa zgjat një pjesë kodi. Për data dhe kalendarë, përdor datetime.
EnglishEN
time.sleep(2) pauses the program for 2 seconds, and time.perf_counter() measures how long some code takes. For dates and calendars, use datetime.
Si ta mendosh
Si kronometri dhe pauza në një lojë.
Lexoje në anglisht
Like a stopwatch and a pause button.
Shembull kodipython
import time
fillimi = time.perf_counter()
time.sleep(1)
print(f"{time.perf_counter() - fillimi:.2f} s")