Would someone kindly review the following code and error? This sample program is copied from Python Programming for the Absolute Beginner (2nd ed.) I'm running Python 2.3.5 (#62, Feb 8 2005, 16:23:02) [MSC v.1200 32 bit (Intel)] on win32. (Python 2.3 is the version referenced in this edition.) Referenced lines 8 and 9 of the error are the 3rd and 2nd lines from the last in the code. Thank you very much. Ellen
#Demonstrates string indexing import random word = "index" print "The word is: ", word, "\n" high = len(word) low = len(word) for i in range(10): position = randrange(low, high) print "word[", position, "]\t", word[position] raw_input("\n\nPress the enter key to exit.") line 8, in -toplevel-position = random.randrange(low, high) #line 9 error: "empty range for randrange" File "C:\Python23\lib\random.py", line 178, in randrange raise ValueError, "empty range for randrange()" ValueError: empty range for randrange()
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor