乐透程序随机编号生成器
我想创建一个程序,其中将选择一组指定号码的组中有4个,并且还将选择另一个指定号码中的2个。例如:(55、50,45、30、3、12、36、9,8,13)中,将有4个数字随机选择。然后另一组(例如(54、43、21、39、46,20,1,5,11)将有另外2个数字随机选择是唯一的。我该如何编码?
I would like to create a program where 4 out of a group of a specified number will be chosen and another 2 out of another specified number will be chosen as well. For example: ( 55, 50,45, 30, 3, 12, 36, 9,8,13) out of this set, there will be 4 numbers that will be randomly chosen. and then another set for example (54, 43, 21, 39, 46,20,1,5,11) there will be another 2 numbers that will be randomly chosen that are unique. How can I code that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我决定在Python撰写我的实施。这将从第一个列表中输出4个唯一值,第二个列表中的两个唯一值。我认为这就是您的代码外观:
希望这会有所帮助!
I decided to write my implementation in Python. This will output 4 unique values from the first list and two unique values from the second list. I think this is what your code should look like:
Hope this helps!