Вот скелет для начала. Используйте встроенную функцию input
, чтобы получить вводимые пользователем данные и проверить, действительны ли они в while
l oop
def isValid(start, end):
# Check if your start and end numbers are value here
return start <= end
def getUserInput():
start = 0
end = -1
while True:
start = input("Enter starting line number: ")
end = input("Enter ending line number: ")
if not isValid(start, end):
print("Invalid input, try again")
else:
break
## Do what you want with the list here
return start, end