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
Alex787 [66]
4 years ago
11

g (b) (4 pt) Write a function unique that identifies the repeated elements of a list and returns a list with unique elements. $

(unique (list)) () $ (unique (list 1 10 3 14)) (1 10 3 14) $ (unique (list 11 18 31 18)) (11 18 31)

Engineering
1 answer:
Taya2010 [7]4 years ago
6 0

Answer:

I am writing a Python function unique()    

def unique(list):  # function unique that takes a list as parameter

 unique_list = []  #list to store unique elements

 for elements in list:  # loop that checks every element of the list

   if elements not in unique_list:  # takes unique elements from list

     unique_list.append(elements)  

#appends unique elements  from list to unique_list

 return unique_list      #outputs unique_list elements

         

Explanation:

The unique() function takes a list as argument which is named as list.

unique_list is a new list which stores unique element from the list.

The loop moves through the elements of the list one by one.

if condition checks if the element in list is not present in the unique_list which means that element is unique to the unique_list.

If this condition is true this means that the element is not repeated and is not already present in unique_list. Then that element is included to the unique_list using append() function which appends an element into the unique_list from the list.

If you want to check if this function works you pass a list with repeated elements to this function so that it can print the unique elements as follows:

print(unique([1,2,2,2,2,3,4,4,4,4,4,5]))

Output:

[1, 2, 3, 4, 5]

The screen shot of the function along with its output is attached.

You might be interested in
A well-established way of power generation involves the utilization of geothermal energy-the energy of hot water that exists nat
jeka94

Answer:

the maximum thermal efficiency is 29%

Explanation:

the maximum efficiency for a thermal engine that works between a cold source and a hot source is the one of a Carnot engine. Its efficiency is given by

Maximum efficiency= 1 - T2/T1

where

T2= absolute temperature of the cold sink (environment)= 20°C + 273 = 293

T2= absolute temperature of the hot source (hot water supply) = 140°C + 273 = 413

therefore

Maximum efficiency= 1 - T2/T1 = 1 - 293/413 = 0,29 =29%

3 0
3 years ago
A hollow pipe is submerged in a stream of water so that the length of the pipe is parallel to the velocity of the water. If the
Arlecino [84]

Answer:

increases by a factor of 6.

Explanation:

Let us assume that the initial cross sectional area of the pipe is A m² while the initial velocity of the water is V m/s², hence the flow rate of the water is:

Initial flow rate = area * velocity = A * V = AV m³/s

The water speed doubles (2V m/s) and the cross-sectional area of the pipe triples (3A m²), hence the volume flow rate becomes:

Final flow rate = 2V * 3A = 6AV m³/s = 6 * initial flow rate

Hence, the volume flow rate of the water passing through it increases by a factor of 6.

8 0
3 years ago
What is differences Between hard shoulder & soft shoulder in civil Engineerin?
r-ruslan [8.4K]

Answer:

<em><u>The 'shoulder' of a road is the land to the edge of the road. On most roads without pavements, the shoulder is a strip of grass or a hedgerow. This is known as a 'soft shoulder'. On a motorway, this strip of land is hardstanding, hence the name 'hard shoulder.'</u></em>

<em><u>Mark</u></em><em><u> </u></em><em><u>as</u></em><em><u> brilliant</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u> </u></em>

5 0
3 years ago
In casting experiments performed using a certain alloy and type of sand mold, it took 170 sec for a cube-shaped casting to solid
poizon [28]

Answer:

Answer for the question is : Solidification time will be same i.e. 170. See attached file for explanation.

Explanation:

Download pdf
7 0
3 years ago
Read 2 more answers
Draw the schematics for the following two battery connections. Can you explain the value of the output voltage in the series con
matrenka [14]

if two 1.5 ya alt batteries are connected to head to the tail the voltage is 3.0 volt it is the because the battery is insidious reduce a voltage equal to number of battery is multiplied by the voltage of individual

5 0
2 years ago
Other questions:
  • . A storm sewer is carrying snow melt containing 1.200 g/L of sodium chloride into a small stream. The stream has a naturally oc
    8·1 answer
  • A soil had a liquid limit of 44, a plastic limit of 21, and a shrinkage limit of 14. In the summer, the in situ water content wa
    14·1 answer
  • You read a research study that concludes that the higher a student's self-esteem, the better he performs in school. This sort of
    5·1 answer
  • Question 4 (1 point)
    8·1 answer
  • For some transformation having kinetics that obey the Avrami equation , the parameter n is known to have a value of 1.1. If, aft
    6·1 answer
  • The fan blades suddenly experience an angular acceleration of 2 rad/s2. If the blades are rotating with an initial angular veloc
    10·1 answer
  • A socket can be driven using any of the following except for (A) a socket ratchet
    14·1 answer
  • A(n) ____ is an exact representation of an object projected onto a plane from a specific position.
    14·1 answer
  • Convert 103.69 kN to TN.
    14·1 answer
  • What are the best collages for architectural learning?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!