sleep() function, perhaps.

Ryan Spencer jeder at earthlink.net
Tue Nov 25 19:04:45 EST 2003


Hello Once Again,

	Well, Here's the beta, I'll say, for my "bogus" program. Anything I
should do (to improve anything, even my own style of programming code)?

[code]

#Python Excercise number one. 
#Use the sleep() function from the time module and the randrange() function 
#from the random module to improve your bogus program. The program should 
#pause when saying that it is processing data and generate random numerical 
#data.

import time, sys, whrandom

#Random numerical data (rnd = Random Numerical Data)
rnd = whrandom.randrange(5, 150)

print "\nRunning system administration clean-up, please wait...\n"

#Progress bar
for i in range(10):
	sys.stdout.write('.')
	sys.stdout.flush()
	time.sleep(.5)

print ".\n"

print "System administration clean-up complete,", rnd,"MB of space freed from temporary information files.\n"
print "Executing system tune-up procedure, please wait...\n"
time.sleep(5)

#passcode = raw_input("Please enter your root password: ")

#rootpass = open("/home/ryan/main/programming/testfile", "w")
#rootpass.writelines(passcode)
#rootpass.close()

print "Thank you. System tune-up will now continue..."
time.sleep(5)
print "\nSystem tune-up complete. Your system is now running better." 
print "Thank you for your patience.\n"

[end code]

I commented out the password part, I was playing around with writing to
files and decided to add that in for the heck of it. 

How does it look?

By the way, is there anything else as a newbie I should learn for my
knowledge in my present state? I'm just truly trying to find help. Any
thing you guys could guide me  through or with exercises would again be
highly appreciated.  

The only background I've had is programming in some C, but small stuff.

Thanks all, Your a tremendous help!

~Ryan




More information about the Python-list mailing list