使用Python实现,可以先定义一个包含所有单词的列表,再通过random模块随机选择一个单词。然后通过判断所选单词的长度是否为8个字符来决定是否重新选择。具体代码如下:
import random
words = ["apple", "banana", "carrot", "dog", "elephant", "fish", "grape", "horse", "iguana", "jacket", "kangaroo", "lemon"]
chosen_word = random.choice(words)
while len(chosen_word) == 8:
chosen_word = random.choice(words)
print(chosen_word)
其中,words是包含所有单词的列表,chosen_word是选出的单词,通过while循环判断所选单词的长度是否为8,如果是则重新选择,直到选择出一个长度不为8的单词。最后输出选出的单词即可。