Ask Question
25 August, 00:29

Write a program that first gets a list of integers from input. The input begins with an integer indicating the number of integers that follow. That list is followed by two more integers representing lower and upper bounds of a range. Your program should output all integers from the list that are within that range (inclusive of the bounds). For coding simplicity, follow each output integer by a space, even the last one. The output ends with a newline.

+1
Answers (1)
  1. 25 August, 02:13
    0
    import array as arr

    a = arr. array ("i")

    b = input ("Enter b:")

    c = input ("Enter c:")

    d = input ("Enter d:")

    a. append (int (b))

    a. append (int (c))

    a. append (int (d))

    len1 = int (b) - 1

    for i in range (0, int (len1)):

    e = input ("Enter the value of e:")

    a. append (int (e))

    i = 3

    len1 = Len (a)

    for i in range (3, len1):

    if a[i] = int (c):

    print (a[i])

    Explanation:

    I have used arrays in the above solutions. And various methods of arrays have been used further like append. The method append adds the new element at the last of the arrays. And the int (b) changes the b data type to integer from string. The process is similar to that as explained in the question. And array library has been used for making use of the array, and use it for storing the integers, and perform all the operations required. The first, second and rest of the elements of the arrays are as mentioned in the question. And finally the array elements are printed that are within the range.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Write a program that first gets a list of integers from input. The input begins with an integer indicating the number of integers that ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers