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
agasfer [191]
3 years ago
9

Exercise 1. (Sum of Integers) Implement the functions sum_iter() and sum_rec() in sum_of_ints.py that take an integer n as argum

ent and return the sum S(n) = 1 + 2 + 3 + · · · + n, computed iteratively (using a loop) and recursively. The recurrence equation for the latter implementation is
Engineering
1 answer:
MatroZZZ [7]3 years ago
8 0

Answer:

Explanation:

We'll start out by prompting users to input an integer n. Then we create 2 functions to calculate the total, one by iteration and the other by recursion.

n = input('Please input an integer n')

def sum_iter(n):

    total = 0

    for i in range(n+1):

         total += i

    return total

sum_iter(n)

def sum_rec(n):

    if n == 0:

         return 0

    else:

         return n + sum_rec(n-1)

sum_rec(n)

You might be interested in
A loss in value caused by an undesirable or hazardous influence offsite is which type of depreciation?
Lubov Fominskaja [6]

External depreciation may be defined as a loss in value caused by an undesirable or hazardous influence offsite.

<h3>What is depreciation?</h3>

Depreciation may be defined as a situation when the financial value of an acquisition declines over time due to exploitation, fray, and incision, or obsolescence.

External depreciation may also be referred to as "economic obsolescence". It causes a negative influence on the financial value gradually.

Therefore, it is well described above.

To learn more about Depreciation, refer to the link:

brainly.com/question/1203926

#SPJ1

5 0
2 years ago
The polycarbonate shell functions as all of the following except:
krok68 [10]

Answer:

what are the answers expect what?

Explanation:

Polycarbonate is commonly used in eye protection, as well as in other projectile-resistant viewing and lighting applications that would normally indicate the use of glass, but require much higher impact-resistance. Polycarbonate lenses also protect the eye from UV light.

6 0
3 years ago
A 1020 Cold-Drawn steel shaft is to transmit 20 hp while rotating at 1750 rpm. Calculate the transmitted torque in lbs. in. Igno
velikii [3]

Answer:

Question 1 A 1020 Cold-Drawn steel shaft is to transmit 20 hp while rotating at 1750 rpm. Calculate the transmitted torque in lbs. in. Ignore the effect of friction. Answer with three decimal points. 60.024 Question 2 Based on the maximum-shear-stress theory, determine the minimum diameter in inches for the shaft in Q1 to provide a safety factor of 3. Assume Sy = 57 Kpsi. Answer with three decimal points. 0.728 Question 3 If the shaft in Q2 was made of ASTM 30 cast iron, what would be the factor of safety? Assume Sut = 31 Kpsi, Suc = 109 Kpsi 0 2.1 O 2.0 O 2.5 0 2.4 2.3 O 2.2

Explanation:

hope it helps

4 0
2 years ago
In crash tests, a shock absorber is used to slow the test car. The shock absorber consists of a piston with small holes that mov
Lesechka [4]

Answer:

The heat transferred to water equals 1600 kJ

Explanation:

By the conservation of energy we have

All the kinetic energy of the moving vehicle is converted into thermal energy

We know that kinetic energy of a object of mass 'm' moving with a speed of 'v' is given by

K.E=\frac{1}{2}mv^{2}

Thus

K.E_{car}=\frac{1}{2}\times 2000\times 40^{2}=1600\times 10^{3}Joules

Thus the heat transferred to water equals 1600kJ

3 0
3 years ago
Suggest suitable materials of construction for the following applications and provide justifications.
Sergio039 [100]

Answer:

a)  316 stainless steel

b)  316 stainless steel

c)  Carbon steel

d)  stainless steel 316

e)  stainless steel 316

f )   Carbon steel

Explanation:

<u>A) A 10,000 M' storage tank for Toluene</u>

The best material for building this tank is 316 stainless steel this is because it is relatively cheaper than other materials such as Hest Alloy C while still maintaining  the required tensile strength needed to build the storage tank for Toluene

<u>B) A 5.0 m' tank for storing a 30% w/w aqueous solution of sodium chloride </u>

The suitable material for building this tank is 316 stainless steel as it is cheaper than Titanium and Hest Alloy C and it is compatible with sodium chloride

<u>C) A 2 m diameter, 20 m high distillation column, distilling acrylonitrile </u>

The best material for constructing this column is  Carbon steel and this is because  it has a very high compressive strength which is approximately . 1320 MPa

<u>D)  A 100 m storage tank for strong nitric acid.</u>

The best material is stainless steel 316 and this is due to its high tensile strength

E) 316 stainless steel

F) Carbon steel is suitable for building this absorption column because  it has a very high compressive strength which is approximately . 1320 MPa

4 0
3 years ago
Other questions:
  • A sample of wastewater is diluted 10 times. The diluted solution has an ultimate biochemical oxygen demand (BOD), Lo, of 30 mg/L
    9·1 answer
  • 3. A 4-m × 5-m × 7-m room is heated by the radiator of a steam-heating system. The steam radiator transfers heat at a rate of 10
    9·1 answer
  • Elizabeth has been asked to design a pool umbrella that can withstand wind speeds of up to 30 miles per hour. Now that she under
    12·2 answers
  • At what distance should the warning triangle be placed if a vehicle breaks down on the autobahn?
    5·1 answer
  • You are given a body with no body forces and told that the stress state is given as: ⎡ ⎣ 3αx 5βx2 + αy γz3 5βx2 + αy βx2 0 γz3 0
    8·1 answer
  • 1. A gas pressure difference is applied to the legs of a U-tube manometer filled with a liquid with S = 1.5. The manometer readi
    9·1 answer
  • 19 million Joules of chemical energy are supplied to a boiler in a power plant. 5 x 106 Joules of energy are lost through unburn
    15·1 answer
  • A driver traveling in her 16-foot SUV at the speed limit of 30 mph was arrested for running a red light at 15th and Main, an int
    6·1 answer
  • Why is communication one of the most important aspects of an engineer’s job?
    7·2 answers
  • vertical gate in an irrigation canal holds back 12.2 m of water. Find the average force on the gate if its width is 3.60 m. Repo
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!