Assuming this question is asking for a code solution in Python:

import random

# Generate a list of 10 random numbers from 1 to 10 (inclusive)
num_list = [random.randint(1, 10) for i in range(10)]

# Filter out even numbers using list comprehension
odd_list = [num for num in num_list if num % 2 != 0]

# Print the original list and the odd numbers list
print("Original list:", num_list)
print("Odd numbers list:", odd_list)

This code generates a list of 10 random numbers from 1 to 10 (inclusive) and then uses list comprehension to filter out even numbers, leaving only odd numbers in a new list. The original list and the odd numbers list are then printed for verification

human2从1到10中随机选取10个数构成一个长度为10的数组选出其中的奇数。

原文地址: https://www.cveoy.top/t/topic/fcVH 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录