Ask Question
24 April, 04:23

Write a Python function uniquely_sorted () that takes a list as a parameter, and returns the unique values in sorted order.

+5
Answers (1)
  1. 24 April, 05:42
    0
    Following is the program in Python language

    def uniquely_sorted (lst1) : #define the function uniquely_sorted

    uni_que = [] #creating an array

    for number in lst1: #itereating the loop

    if number not in uni_que: #check the condition

    uni_que. append (number) #calling the function

    uni_que. sort () #calling the predefined function sort

    return uni_que #returns the unique values in sorted order.

    print (uniquely_sorted () ([8, 6, 90, 76])) #calling the function uniquely_sorted ()

    Output:

    [6,8,76,90]

    Explanation:

    Following are the description of the Python program

    Create a functionuniquely_sorted () that takes "lst1" as a list parameter. Declared a uni_que[] array. Iterating the loop and transfer the value of "lst1" into "number" Inside the loop call, the append function. the append function is used for adding the element in the last position of the list. Call the predefined function sort (for sorting). Finally, call the function uniquely_sorted () inside the print function.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Write a Python function uniquely_sorted () that takes a list as a parameter, and returns the unique values in sorted order. ...” 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