def find_nth_smallest(numbers_list, n):
numbers_list.sort() #将列表内的数从小到大排列 sort()
if n>len(numbers_list): #判断是否有第n个小的数
return None
else:
return numbers_list[n-1] #在重新排列的列表中 找出第n个小的数 第n个
#对应列表中第n-1个
numbers_list = list(map(int, input("请输入:").split()))
n = int(input('你要查找第几个:'))
print(f'你查找的最小的数字:{find_nth_smallest(numbers_list,n)}')
请输入:4 3 8 6 9 7
你要查找第几个:3
你查找的最小的数字:6