简体   繁体   English

尝试创建 1-10 之间的 10 个随机数的列表,这些随机数在 python 中不重复

[英]Trying to create a list of 10 random numbers between 1-10 that do not repeat in python

This is not the whole program I want to write but right now I'm just trying to figure out this simple thing.这不是我想要编写的整个程序,但现在我只是想弄清楚这个简单的事情。 And if you couldn't tell, I am completely new to programming.如果你不知道,我对编程完全陌生。

import random
random.sample(range(10), 10)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Python 循环:计算 1-10 的 2 个随机值之间的总和 - Python loop: calculate sum between 2 random values from 1-10 Python:生成数字1-10的列表,但是1最终出现在列表的末尾吗? - Python: Generating list of numbers 1-10, but 1 ends up at the end of the list? 如何使非列表循环从1-10中选择4个随机数并显示它们,但它们不能相同? - How to make a non list Loop that will select 4 random numbers from 1-10, and display them, but they cannot be the same? [python]使用数字1-10编写数据文件 - [python]Writing a data file using numbers 1-10 在1到10之间缩放python数据框的特定列的值 - Scale values of a particular column of python dataframe between 1-10 你如何列出数字 1-10 前面有东西 - How do you list number 1-10 with something in front of it 列表中的计数数字在 python 中介于 1 和 10 之间 - count numbers in the list are between 1 and 10 in python 如何创建一个以随机顺序打印数字 1 到 10 的 python 程序? - How do I create a python program that prints the numbers 1 to 10 in a random order? 寻找一种简单有效的方法在 python 中生成随机数,以便在每 10 个数字序列中数字不会重复 - Looking for a simple and efficient way to generate random numbers in python so that in every 10 number sequance the numbers won't repeat 如何在列表中随机 1 到 5 之间的 10 个数字,并且列表必须包含所有数字 - how to random 10 numbers between 1 and 5 in list and the list must inculde all number
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM