Skip to content

Instantly share code, notes, and snippets.

@naufalafif
Last active October 9, 2020 21:25
Show Gist options
  • Save naufalafif/a1a365dd32034e51033df2dce54bf12f to your computer and use it in GitHub Desktop.
Save naufalafif/a1a365dd32034e51033df2dce54bf12f to your computer and use it in GitHub Desktop.
import time
def fake_heavy_computation(value):
""" function ini mensimulasikan komputasi berat"""
time.sleep(2) # menunggu 2 detik untuk lanjut ke statement berikutnya
return value
start_time = time.time()
fake_heavy_computation(2)
print(f"selesai dalam {(time.time()-start_time)} detik")
# selesai dalam 2.002336025238037 detik
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment