Consider the following two options for printing a random string from a list of messages:
import random
messages = ['It is certain',
'It is decidedly so',
'Yes definitely',
'Reply hazy try again',
'Ask again later',
'Concentrate and ask again',
'My reply is no',
'Outlook not so good',
'Very doubtful']
print(messages[random.randint(0, len(messages) - 1)]) # option 1
print(random.choice(messages)) # option 2
Both option 1 and option 2 produce the same effect. Is there a reason to prefer one over the other? What about performance—is one more efficient than the other?