Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Implement a textual progress bar in python. In any progress bar the space occupi

ID: 3543687 • Letter: I

Question

Implement a textual progress bar in python. In any progress bar the space occupied by its infinite. Lets say the textual progress bar could show only 10 Xs. so you have to devide the total times by 10, and after those many seconds, you have to print an X on the output.


for example if the time is 100 seconds:


At  0  secs:

At 10 secs: X

At 20 secs : XX

....


At 100 secs: XXXXXXXXXX


write a function that makes the number of seconds as input and implement the progress bar. This is easier if you look up pythons  TIME module either in the documentaion or online.

Explanation / Answer

import sys, time

def textual_progress(secs):
for i in range(10):
time.sleep(secs/10.0)
sys.stdout.write('X')
sys.stdout.flush()
print('')

if __name__ == '__main__':
secs = input('Enter seconds: ')
textual_progress(int(secs))



with indentation: http://ideone.com/KYbpuG



Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote