In the code below, the only part I'M having trouble with is word[position]. I know this is something really simple but I've always had trouble understanding these kinds of statements. I know that it print a random letter (position) from (word). What I don't know is [b]why[/b] or [b]how[/b] it does that. That's the part that never seems to get explained to me. How can you just put  around part of a statement and everything just work right? Thanks.
[code]# Random Access
# Demonstrates string indexing
word = "index"
print "The word is: ", word, "
high = len(word)
low = -len(word)
for i in range(10):
position = random.randrange(low, high)
print "word[", position, "] ", word[position]
Press the enter key to exit.")[/code]
0 · ·