这是我当前的代码:
import random
while True:
try:
num = int(input("Enter the total number of digits you want to generate:"))
upper = int(input("Enter your highest number:"))
lower = int(input("Enter your lowest number:"))
if upper < 1 or lower < 1 or upper <= lower:
print ("Sorry, invalid. Make sure your upper bound is higher than lower bound, make sure all numbers are integers greater than 0.")
continue
if num < 1:
print ("Sorry, invalid. Try again.")
continue
**mylist = [0] * num
for x in range (lower, upper):**
这里正上方的部分是我不太确定如何继续前进的部分。我想根据用户输入的数字以及用户在此处显示的列表中输入的上限和下限生成随机数。有人可以指导我完成这个吗?谢谢你!
except:
print ("Sorry, invalid. Try again.")
else:
print ("Thank you.")
break