阅读背景:

Python - 获取一个列表并返回有序对中的随机元素(必须是可变的)

来源:互联网 

I have a list I want to take random pieces out of that are 2 at a time. If my list is 1, 2, 3, 4, 5... I want to return 2 and 3 or 3 and 4 or 1 and 2 but not 1 and 4 etc. I know how to use random and its reading from a file and converted into a list called "word" so can I iterate over "word" and pull any two random words that are right next to each other and pass them in a pair to a new variable? I have a list I want to take random pieces out




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: