-
I was wondering if there's anyway to implement tqdm on a while-loop that terminates at certain minimal value rather than an upper bound? I don't quite know how to rewrite this as a for-loop to use tqdm. For example: while h > 0:
....
h /= 3 Thank you. |
Beta Was this translation helpful? Give feedback.
Answered by
casperdcl
Jun 22, 2021
Replies: 1 comment 1 reply
-
while h > 0:
h /= 3 will technically be an infinite loop if it weren't for machine precision. You could do: with tqdm() as t:
while h > 0:
h /= 3
t.update() or if instead you mean: while h > 1:
h /= 3 then you could do: import math
from tqdm import trange
total = int(math.ceil(math.log(h, 3)))
for _ in trange(total):
if h <= 1:
break
h /= 3 |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
GoodluckH
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
will technically be an infinite loop if it weren't for machine precision.
You could do:
or if instead you mean:
then you could do: