70,751 views
31 votes
31 votes
In your guessing game, you randomly chose a word from your word list. Complete the code to randomly choose an index found in the list.

import random
count = len(words)
wordIndex =

A. random.random(0,count)
B. random.random(0,count - 1)
C. random.randint(0,count)
D. random.randint(0,count - 1)

User SpamBot
by
2.9k points

2 Answers

21 votes
21 votes

Answer: random.randint(0,count - 1)

Explanation: Not necessarily answer D because Edge switches the order of the questions for everyone. Just know its random.randint(0,count - 1)

User Eric Weilnau
by
2.6k points
17 votes
17 votes

Answer:

the answer is D random.randint(0,count -1)

Step-by-step explanation:

I took the assignment

User E Rolnicki
by
3.2k points