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
​please how to drawing mechanical drawing after connecting the all parts thanks
rusak2 [61]
The answer would have to be 7
3 0
2 years ago
The disk of radius 0.4 m is originally rotating at ωo=4 rad/sec. If it is subjected to a constant angular acceleration of α=5 ra
Lina20 [59]

Answer:32.4m/s^2

Explanation:

Given data

radius\left ( r\right )=0.4m

Intial angular velocity\left ( \omega_0\right )=4rad/s

angular acceleration\left ( \alpha\right )=5rad/s^2

angular velocity after 1 sec

\omega=\omega_0+\alpha\times\t

\omega=4+5\left ( 1\right )

\omega=9rad/s

Velocity of point on the outer surface of disc\left ( v\right )=\omega_0\timesr

v=9\times0.4 m/s=3.6m/s

Normal component of acceleration\left ( a_c\right )=\frac{v^2}{r}

a_c=\frac{3.6\times3.6}{0.4}=32.4m/s^2

3 0
4 years ago
Computers work with only two states: zero and one (e.g. short , tall)and is known as binary however in fuzzy logic there are ran
Ymorist [56]

Answer:

1) a)True

   b) False

2) False

2. True

4. True

5. True

Explanation:

1.a)Computers work with only two states: zero and one which is true, the language is in 1 and 0 which is called binary

b)in fuzzy logic there are range of states such as short, little tall, very tall etc...

That is false because Fuzzy logic contains also ones and zeros (Binary).

2)2. This is false because by combining the three colors we will get only

256*256*256 color and we don't get billions of colors

eg:R G B

255 0 0 -->one color

220 0 200---> one color

Due to the difficult economic times, increased global competition, demand for customization, and increased consumer sophistication, many companies have increased their investment in hiring many employees, and outsource & off shore middle managers True or False

yes this may be True because By increased global competition, demand for customization the product needs to be developed. And for development of new products we need employees, managers etc. This in-turn increases the outsourcing of offshore middle managers.

A mouse driver (software) can have a virus if its program gets infected true or False

This is True

It depends on the virus file. Some program need to be execute perfectly if it can be infected with virus. Some applications need not run because of virus files both the situations are possible.

5)Many managers were able to tackle y2k on time and saved billions. true or False;

This is True. After the year 2000, a lot of managers are able to control billions of people because many of the Top MNC's are tackled more by managers.

5 0
4 years ago
8.17 Water is the working fluid in a Rankine cycle. Superheated vapor enters the turbine at 10 MPa, 4808C, and the condenser pre
katrin2010 [14]

Answer:

attached below

Explanation:

8 0
3 years ago
QUESTION
Ymorist [56]
Torch body if I’m wrong I’m really sorry that’s what I got
3 0
3 years ago
Other questions:
  • When the desired section has been cut out and is not seen elsewhere on the drawing, a(n) ____is being used.
    15·1 answer
  • "An equal-tangent sag vertical curve connects a –1.5% initial grade and a +1.25% final grade. The design speed is 70 mi/h and th
    13·1 answer
  • Around the 1760s what allowed for more supplies to be moved around?
    13·1 answer
  • Create a document that includes a constructor function named Company in the document head area. Include four properties in the C
    7·1 answer
  • PLEASE QUICK!!!!!!!!!!! Overtime people have given names to groups of stars called_____
    14·1 answer
  • Challenge:
    5·1 answer
  • Giving out 100 coins cuz why not?​
    11·1 answer
  • I need the answer please
    7·1 answer
  • Okay<br>going offline bye<br>have a great day​
    10·2 answers
  • A complete mix of an activated sludge system without primary clarification is used for treatment of municipal wastewater with a
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!