Ask 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 follow. Then, adjust each integer in the list by subtracting the smallest value from all the integers.

+3
Answers (1)
  1. 22 April, 09:15
    0
    The following are the program in the Python Programming Language.

    #set variable and get input from user

    num = int (input ("Enter the number of the data set: "))

    #print the following message

    print ("Enter the {} numbers:". format (num))

    #set empty list type variable

    lst = []

    #set the for loop

    for i in range (num):

    #get the list type input from the user

    n=int (input ())

    #add the input in the list

    lst. append (n)

    #store the minimum value in the variable

    min_val = min (lst)

    #print the minimum value of the list

    print ("The smallest value is:", min_val)

    #print the following message

    print ("The normalized data set is:")

    #set loop to print list

    for x in lst:

    print (x-min_val)

    Explanation:

    The following are the description of the program.

    Firstly, set the variable 'num' in which we get the input from the user and print the following message. Then, set the empty list type variable 'lst' in which we get input from the user through the for loop. Set variable 'min_val' in which we store the minimum value of the list. Then, print the minimum value of the list and print the following message. Finally, set the for loop that prints the list after the deduction by the minimum value of the list.
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 & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers