Created
September 28, 2020 02:22
-
-
Save afeish/5c81fdef62c8857590fb97707650dc77 to your computer and use it in GitHub Desktop.
progressing-bar using python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
scale = 50 | |
print("starting".center(scale // 2,"-")) | |
start = time.perf_counter() | |
for i in range(scale + 1): | |
a = "*" * i | |
b = "." * (scale - i) | |
c = (i / scale) * 100 | |
dur = time.perf_counter() - start | |
print("\r{:^3.0f}%[{}->{}]{:.2f}s".format(c,a,b,dur),end = "") | |
time.sleep(0.1) | |
print("\n"+"end".center(scale // 2,"-")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment