Python电脑随机输入五个数并大小排列

电脑随机输入5个数字,并排列
自己再输入个数字
用(循环,判断)自己输入的数字在电脑输入的数字中哪个位置
并用insert插入数字
最后再重新排列,输出

import random

a = range(100)
b = sorted(random.sample(a, 5))
print("电脑输入数:", b)

c = int(input('请输入一个数:'))
index = 0
print("你输入数:", c)
for i in range(len(b)):
if b[i] >= c:
index = i
break
print("插入位置:", index)
b.insert(index, c)
print('新数列:', b)

1.先设定一个数据的范围,使用range取一个数据库
2.使用random在数据库中取五个随机数并排序 random.sample和sorted
3.循环遍历排序后的数组对比自己输入的数,当大于等于自己输入的数时即是插入位置,使用range取数组长度遍历索引
4.插入数据并输出insert