Write a program that first reads in the name of an input file, followed by two strings representing the lower and upper bounds of a search range. The file should be read using the file.readlines() method. The input file contains a list of alphabetical, ten-letter strings, each on a separate line. Your program should output all strings from the list that are within that range (inclusive of the bounds). Ex: If the input is: inputi.txt ammoniated millennium and the contents of input1.txt are: aspiration classified federation graduation millennium philosophy quadratics transcript wilderness zoologists the output is: aspiration classified federation graduation millennium Notes: • There is a newline at the end of the output. • input1.txt is available to download. • In the tests, the first word input always comes alphabetically before the second word input.

Respuesta :

Input:

input1.txt

classified

zoologists

what are the two strings representing the lower and upper bounds of a search range?

The lower bound of a search range is typically represented as a string that is less than or equal to the target value, while the upper bound of a search range is typically represented as a string that is greater than or equal to the target value.

input_file = 'input1.txt' #input('File name:')

start = 'ammoniated' #input('Upper bound:')

end = 'millennium' #input("Lower bound:")

with open(Input_file, 'r') as f:  

 contents = f.readlines()

for i in range(len(contents)):

 if  (contents[i] >= start) and (contents[i] <= end):

   print(contents[i],end='')

input_file, start and end are supposed to be user enterable, but I have commented them out and hard coded them for ease of testing.

To learn more about strings refer to:

https://brainly.com/question/20813205

#SPJ4

ACCESS MORE
EDU ACCESS