1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
slega [8]
3 years ago
15

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

Computers and Technology
1 answer:
ivann1987 [24]3 years ago
7 0

Answer:

   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.

   

You might be interested in
Explain why a single 500 kg block of granite weathers much more slowly than 100 chunks of granite weighing 5 kg each.
Bad White [126]
Weathering occurs on the surface of rocks, and lots of small rocks have a much greater surface area than one big rock.
3 0
3 years ago
Read 2 more answers
If you enter the search "genetically modified foods" in a database, the double quotes around the three words will:
In-s [12.5K]

Answer:

Have a more specified search

Explanation:

If you do this in G0OGLE Then it will be the same thing all it basically does it narrow down the search to find more of what you want

4 0
2 years ago
A datagram network allows routers to drop packets whenever they need to. The probability of a router discarding a packetis p. Co
tresset_1 [31]

Answer:

a.) k² - 3k + 3

b.) 1/(1 - k)²

c.) k^{2}  - 3k + 3 * \frac{1}{(1 - k)^{2} }\\\\= \frac{k^{2} - 3k + 3 }{(1-k)^{2} }

Explanation:

a.) A packet can make 1,2 or 3 hops

probability of 1 hop = k  ...(1)

probability of 2 hops = k(1-k)  ...(2)

probability of 3 hops = (1-k)²...(3)

Average number of probabilities = (1 x prob. of 1 hop) + (2 x prob. of 2 hops) + (3 x prob. of 3 hops)

                                                       = (1 × k) + (2 × k × (1 - k)) + (3 × (1-k)²)

                                                       = k + 2k - 2k² + 3(1 + k² - 2k)

∴mean number of hops                = k² - 3k + 3

b.) from (a) above, the mean number of hops when transmitting a packet is k² - 3k + 3

if k = 0 then number of hops is 3

if k = 1 then number of hops is (1 - 3 + 3) = 1

multiple transmissions can be needed if K is between 0 and 1

The probability of successful transmissions through the entire path is (1 - k)²

for one transmission, the probility of success is (1 - k)²

for two transmissions, the probility of success is 2(1 - k)²(1 - (1-k)²)

for three transmissions, the probility of success is 3(1 - k)²(1 - (1-k)²)² and so on

∴ for transmitting a single packet, it makes:

     ∞                             n-1

T = ∑ n(1 - k)²(1 - (1 - k)²)

    n-1

   = 1/(1 - k)²

c.) Mean number of required packet = ( mean number of hops when transmitting a packet × mean number of transmissions by a packet)

from (a) above, mean number of hops when transmitting a packet =  k² - 3k + 3

from (b) above, mean number of transmissions by a packet = 1/(1 - k)²

substituting: mean number of required packet =  k^{2}  - 3k + 3 * \frac{1}{(1 - k)^{2} }\\\\= \frac{k^{2} - 3k + 3 }{(1-k)^{2} }

6 0
3 years ago
What is point mode in excel 2013?
gtnhenbr [62]
I believe it means bullet points as in a form of typing
6 0
3 years ago
Create a Visual Logic flow chart with four methods. Main method will create an array of 5 elements, then it will call a read met
pogonyaev

Answer:

See explaination

Explanation:

import java.util.Scanner;

public class SortArray {

public static void main(String[] args) {

// TODO Auto-generated method stub

Scanner sc = new Scanner(System.in);

System.out.println("Enter Size Of Array");

int size = sc.nextInt();

int[] arr = new int[size]; // creating array of size

read(arr); // calling read method

sort(arr); // calling sort method

print(arr); // calling print method

}

// method for read array

private static void read(int[] arr) {

Scanner sc = new Scanner(System.in);

for (int i = 0; i < arr.length; i++) {

System.out.println("Enter " + i + "th Position Element");

// read one by one element from console and store in array

arr[i] = sc.nextInt();

}

}

// method for sort array

private static void sort(int[] arr) {

for (int i = 0; i < arr.length; i++) {

for (int j = 0; j < arr.length; j++) {

if (arr[i] < arr[j]) {

// Comparing one element with other if first element is greater than second then

// swap then each other place

int temp = arr[j];

arr[j] = arr[i];

arr[i] = temp;

}

}

}

}

// method for display array

private static void print(int[] arr) {

System.out.print("Your Array are: ");

// display element one by one

for (int i = 0; i < arr.length; i++) {

System.out.print(arr[i] + ",");

}

}

}

See attachment

6 0
3 years ago
Other questions:
  • ACCOUNTING
    13·2 answers
  • The use of IDPS sensors and analysis systems can be quite complex. One very common approach is to use an open source software pr
    9·2 answers
  • Rick works for the government and is investigating a small business that the government suspects has been cheating on its taxes.
    15·1 answer
  • IOS jail broken or Android unrooted which is better to hack with
    6·1 answer
  • In a _____ network, each device on the network is attached to a central router. If the router fails, then the other devices will
    13·1 answer
  • WHAT THE DEFINITION OD ENGINEER. No CHEAT
    5·2 answers
  • What is one pass of a coding sequence called?​
    13·2 answers
  • Write the definition of a function reverse, whose first parameter is an array of integers and whose second parameter is the numb
    15·1 answer
  • Object-Oriented Programming (Using Java Language)
    11·1 answer
  • you want to upgrade your windows 10 professional computer to windows 11 professional. you begin by checking the hardware and dis
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!