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
galben [10]
3 years ago
10

The fractional_part function divides the numerator by the denominator, and returns just the fractional part (a number between 0

and 1). Complete the body of the function so that it returns the right number. Note: Since division by 0 produces an error, if the denominator is 0, the function should return 0 instead of attempting the division.

Engineering
1 answer:
Kisachek [45]3 years ago
4 0

Answer:

Here is the fractional_part() function:

def fractional_part(numerator, denominator):

   if denominator != 0:

       return (numerator % denominator)/denominator

   else:

       return 0

Explanation:

I will explain the code line by line.

The first statement it the definition of function fractional_part() which takes two parameters i.e. numerator and denominator to return the fractional part of the division.

Next is an if statement which checks if the value of denominator is 0. If this is true then the function returns 0. If this condition evaluates to false which means that the value of denominator is not 0 then return (numerator % denominator)/denominator  is executed. Now lets see how this statement works with the help of an example.

Lets say the value of numerator is 5 and denominator is 4. (numerator % denominator)/denominator will first compute the modulus of these two values. 5 % 4 is 1 because when 5 is divided by 4 , then the remainder is 1. Now this result is divided by denominator to get the fractional part. When 1 is divided by 4 the answer is 0.25. So this is how we get the fractional part which is 0.25.  

The program with output is attached.

You might be interested in
Suppose that we have a 1000pF parallel-plate capacitor with air dielectric charged to 1000V. The capacitor terminals are open ci
N76 [4]

Answer:

W = 1 mJ

V_new = 2000 V

W_new = 2 mJ

The extra energy came from the work done from moving the plates

Explanation:

We are given;

Capacitance; C = 1000pF = 10^(-9) F

Voltage; V = 1000V

Now,formula for stored energy in a parallel plate capacitor is given by;

W = (1/2)CV² = (1/2)(10^(-9))(1000²) = 0.5 mJ

However, in this case, it's W = 0.5 x 2 = 1 mJ since parallel-plate capacitor with air dielectric

When plates are moved and distance between plates is doubled(net charge is the same), thus we can calculate voltage from;

Q = CV

Since, C_new = C/2

Thus,

Q = (C/2)V_new

V_new = 2Q/C

Thus, V_new = 2V

Thus, V_new = 2 x 1000 = 2000 V

Now,

W_new = (1/2)C_new•(V_new)² = (1/2) (0.5C)•(2V)² = CV² = 2W = 2 x 1 = 2mJ

4 0
3 years ago
The dramatic growth in the number of power data centers, cell towers, base stations, recharge mobiles, and so on is damaging the
Elis [28]

Answer:

True

Explanation:

The statement is true because power data centers, cell towers, base stations, recharge mobiles, and so on emit electromagnetic waves which radiate to the space and causes ozone layer depletion which are harmful to both planet and human in such that it damage the ecosystem and release of ultraviolet rays causes skin cancers in human living in the environment.

7 0
3 years ago
Turpentine flows through a 12-nominal schedule 40 pipe. What is the flow rate that corresponds to a Reynolds number of 2000?
r-ruslan [8.4K]

Answer:

flow rate is 8.0385 × x^{-4} m³/s or 12.741 gpm

Explanation:

given data

12-nominal schedule 40 pipe

Reynolds number = 2000

to find out

What is the flow rate

solution

we know the diameter of 12-nominal schedule 40 pipe is

Diameter = 12.75 inch

D = 0.32385 m

and

dynamic viscosity of Turpentine is = 0.001375 Pa-s

and Density of Turpentine is 870 kg/m³

so

Reynolds number is express as

Re = \frac{\rho*V*D}{\mu}

here ρ is density and D is diameter and V is velocity and µ is viscosity

so put here all value

2000 = \frac{870*V*0.3238}{0.001375}

V = 9.7619 × x^{-3} m/s

and

flow rate is

Q = V  × A

here A is area and Q is flow rate

Q = 9.7619 × x^{-3}  ×  \frac{\pi }{4} * 0.3238^2

Q = 8.0385 × x^{-4} m³/s

so flow rate is 8.0385 × x^{-4} m³/s or 12.741 gpm

4 0
4 years ago
A museum has three rooms, each with a motion sensor (m0, m1, and m2) that outputs 1 when motion is detected. At night, the only
nordsb [41]

Answer:

a) see attachment

b) A= m0m1+ m1m2+ m0m2

see attachment for K-map

c) see attachment

Explanation:

a) see attachment for truth table

b) see attachment for k-map

A= m0m1+ m1m2+ m0m2

c) see attachment for gate level circuit

4 0
3 years ago
David wants to determine what his organization should do in the future, and set project targets. Which management function can D
Alinara [238K]

Answer:

Forecasting

Explanation:

Organizational forecasting is estimating of future events for the purpose of effective planning and decision making. This is one of the critical organizational functions as the forecast help managers to anticipate the future and to plan accordingly. Examples are financial forecasting, reporting, and operational metrics tracking, analyze financial data, create financial models use to predict future revenues.

8 0
4 years ago
Other questions:
  • Water discharging into a 10-m-wide rectangular horizontal channel from a sluice gate is observed to have undergone a hydraulic j
    14·1 answer
  • How is the foundation for a skyscraper different from a house?
    5·1 answer
  • Technician A says independent shops are not affiliated with vehicle manufacturers, but it is easy for technicians who work in th
    8·1 answer
  • What is a "gob" as described in the glass making process?
    9·1 answer
  • A town is designing a rectangular, 4m deep settling tank for treating surface water intake. The tank will have a flow velocity o
    14·1 answer
  • Consider a 2.4-kW hooded electric open burner in an area where the unit costs of electricity and natural gas are $0.10/kWh and $
    9·1 answer
  • A(n) _____ is a stationary insulated wire wrapped in a circular shape around iron pole shoes located inside the starter motor ho
    13·1 answer
  • The five Human Factors which contribute to lab safety are?
    10·1 answer
  • If you are running and you fall and everyone↓↓↓↓↓↓↓ passes you how can you still be in first place??
    12·1 answer
  • Define waves as it applies to electromagnetic fields
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!