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 gas contained in a piston cylinder assembly undergoes a process from state 1 to state 2 defined by the following relationship
Minchanka [31]

Answer:

V2 = final volume = 8.3m^3

Explanation:

Given P1 = 445 kPa, V1 = 2.6 m^3, P2 = 140 kPa

From PV = constant; P1V1 =P2V2 , where V2 = final volume

V2 = P1V1/P2

Substituting in the equation ;

V2 = 445 x 2.6 / 140

V2 = final volume = 8.3m^3

6 0
3 years ago
A 1.7 cm thick bar of soap is floating in water, with 1.1 cm of the bar underwater. Bath oil with a density of 890.0 kg/m{eq}^3
PIT_PIT [208]

Answer:

The height of the oil on the side of the bar when the soap is floating in only the oil is 1.236 cm

Explanation:

The water level on the bar soap = 1.1 m mark

Therefore, the proportion of the bar soap that is under the water is given by the relation;

Volume of bar soap = LW1.7

Volume under water = LW1.1

Volume floating = LW0.6

The relative density of the bar soap = Density of bar soap/(Density of water)

= m/LW1.7/(m/LW1.1) = 1.1/1.7

Given that the oil density = 890 kg/m³

Relative density of the oil to water = Density of the oil/(Density of water)

Relative density of the oil to water = 890/1000 = 0.89

Therefore, relative density of the bar soap to the relative density of the oil = (1.1/1.7)/0.89

Relative density of the bar soap to the oil = (1.1/0.89/1.7) = 1.236/1.7

Given that the relative density of the bar soap to the oil = Density of bar soap/(Density of oil) = m/LW1.7/(m/LWX) = X/1.7 = 1.236/1.7

Where:

X  = The height of the oil on the side of the bar when the soap is floating in only the oil

Therefore;

X = 1.236 cm.

3 0
4 years ago
What is the short description for Determining Deflections by Using Discontinuity Functions ?
maksim [4K]

Answer? somey

Explanation:

soy sause

6 0
3 years ago
Calculate the amount of power (in Watts) required to move an object weighing 762 N from point A to point B within 29 seconds. Di
Tresset [83]

Answer:

0.556 Watts

Explanation:

w = Weight of object = 762 N

s = Distance = 5 m

t = Time taken = 29 seconds

a = Acceleration

g = Acceleration due to gravity = 9.81 m/s²

Equation of motion

s=ut+\frac{1}{2}at^2\\\Rightarrow a=\frac{2\times (s-ut)}{t^2}\\\Rightarrow a=\frac{2\times (5-0)}{29^2}=\frac{10}{481}

Mass of the body

m=\frac{w}{g}=\frac{762}{9.81}

Force required to move the body

F=ma\\\Righarrow F=\frac{762}{9.81}\times \frac{10}{481}

Velocity of object

v=u+at\\\Rightarrow v=0+\frac{10}{481}\times 29\\\Rightarrow v=\frac{10}{29}

Power

P=Fv\\\Rightarrow P=\frac{762}{9.81}\times \frac{10}{481}\times \frac{10}{29}=0.556\ W

∴ Amount of power required to move the object is 0.556 Watts

7 0
4 years ago
Cos square there + cos square theta multiply cot square theta = cot square theta​
Ivahew [28]

Explanation:

We need to prove that : \cos^2\theta+\cos^2\theta {\cdot} \cot^2\theta=\cot^2\theta

Taking LHS : \cos^2\theta+\cos^2\theta {\cdot} \cot^2\theta

Taking \cos^2\theta common as follows :

\cos^2\theta(1+ \cot^2\theta) ...(1)

We know that :

cosec^2\theta-\cot^2\theta=1\\\\cosec^2\theta=1+\cos^2\theta ....(2)

Use equation (2) in equation (1) as follows :

\cos^2\theta{\cdot} cosec^2\theta

We know that : cosec\theta=\dfrac{1}{\sin\theta}

So,

\cos^2\theta{\cdot} \dfrac{1}{\sin^2\theta}\\\\=\cot^2\theta

=RHS

Hence, LHS = RHS

8 0
3 years ago
Other questions:
  • Write the implementation (.cpp file) of the Player class from the previous exercise. Again, the class contains:
    11·1 answer
  • Convert 250 lb·ft to N.m. Express your answer using three significant figures.
    6·1 answer
  • A baseband signal with a bandwidth of 100 kHz and an amplitude range of±1 V is to be transmitted through a channel which is cons
    8·2 answers
  • What 2 disciplines comprise systems engineering?
    15·1 answer
  • A 10-mm steel drill rod was heat-treated and ground. The measured hardness was found to be 290 Brinell. Estimate the endurance s
    14·1 answer
  • Consider a very long, cylindrical fin. The temperature of the fin at the tip and base are 25 °C and 50 °C, respectively. The dia
    14·1 answer
  • Which explanation best identifies why the company in the following scenario has decided against investing in solar energy?
    8·1 answer
  • What is 203593^54/38n^7
    6·1 answer
  • Give me an A please!!!¡!!!!¡
    5·1 answer
  • Optimum engine oil pressure at operating temperature and moderate engine load should be __________ ps
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!