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

Sum of Numbers Design a function that accepts an integer argument and returns the sum of all the integers from 1 up to the numbe

r passed as an argument. For example, if 50 is passed as an argument, the function will return the sum of 1, 2, 3, 4, . . . 50. Use recursion to calculate the sum. Demonstrate the function in a program.
Engineering
1 answer:
cestrela7 [59]3 years ago
4 0

Answer:

# define main to get an argument from the user, call the function, and display the final values

def main():

 # ask an argument from the user.

 number = int(input('Enter a positive integer: '))

 # solve the integral thing of the number by putting the user's argument in the addition() function

 finalSum = addition(number)

 # display the final value integral thing

 print("The integral of this number is ", finalSum, ".")

# define an addition function to find the integral

def addition(num):

 # make an if-statement to test filter things out of your calculations. In this case, 1.

 if num == 1:

   #if 1, return 1. because 1 + (1 - 1) = 1

   return 1

 # this is where the recursion actually is. This is the part that calculates

 else:

   return num + addition(num-1)

# call your main function

main()

Explanation:

This is written in Python. A link to the output can be found below.

https://Sum-of-Numbers.hufflepuffler07.repl.run

You might be interested in
For some transformation having kinetics that obey the Avrami equation (Equation 10.17), the parameter n is known to have a value
OleMash [197]

Answer:

t = 25.10 sec

Explanation:

we know that Avrami equation

Y = 1 - e^{-kt^n}

here Y is percentage of completion  of reaction = 50%

t  is duration of reaction = 146 sec

so,

0.50 = 1 - e^{-k^146^2.1}

0.50 = e^{-k306.6}

taking natural log on both side

ln(0.5) = -k(306.6)

k = 2.26\times 10^{-3}

for 86 % completion

0.86 = 1 - e^{-2.26\times 10^{-3} \times t^{2.1}}

e^{-2.26\times 10^{-3} \times t^{2.1}} = 0.14

-2.26\times 10^{-3} \times t^{2.1} = ln(0.14)

t^{2.1} = 869.96

t = 25.10 sec

5 0
3 years ago
Hi I don't know of yall remeber me, but I'm Jadin aka J. I am looking for my friend group, that I have missed but can't find cau
kirill [66]

Answer:

The young lady was his daughter.The shoemaker was frightened when he saw that she wants to sit near him and took his knife to frighten her and leave him alone to do his work

Explanation:

could uh name them since if i know any i would surely tryin help

7 0
2 years ago
Water flows through a pipe and enters a section where the cross sectional area is larger. Viscosity, friction, and gravitational
BaLLatris [955]

Answer:

(A) and (D)

Explanation:

1) P2 is less than P1, that is when P1 increases in pressure, the velocity V1 of the water also increases. Therefore, on the other hand, since P2 is directly proportional to V1, P2 and V2 will be less than P1 and V1 respectively.

2) For P2 greater than P1 and V2 also is greater than V1. Since P2 is directly proportional to V2, hence, when P2 increases in pressure, P1 reduces in pressure. Similarly, velocity, V2 also increases and V1 reduces.

3 0
3 years ago
Determine the voltages at all nodes and the currents through all branches. Assume that the transistor B is 100,
iren [92.7K]

Answer:

The voltages of all nodes are, IE = 4.65 mA, IB =46.039μA,  IC=4.6039 mA, VB = 10v, VE =10.7, Vc =4.6039 v

Explanation:

Solution

Given that:

V+ = 20v

Re = 2kΩ

Rc = 1kΩ

Now we will amke use of the method KVL in the loop.

= - Ve + IE . Re + VEB + VB = 0

Thus

IE = V+ -VEB -VB/Re

Which gives us the following:

IE = 20-0.7 - 10/2k

= 9.3/2k

so, IE = 4.65 mA

IB = IE/β +1 = 4.65 m /101

Thus,

IB = 0.046039 mA

IB = 46.039μA

IC =βIB

Now,

IC = 100 * 0.046039

IC is 4.6039 mA

Now,

VB = 10v

VE = VB + VEB

= 10 +0.7 = 10.7 v

So,

Vc =Ic . Rc = 4.6039 * 1k

=4.6039 v

Finally, this is the table summary from calculations carried out.

Summary Table

Parameters          IE       IC           IB            VE       VB         Vc

Unit                     mA     mA          μA            V           V          V

Value                  4.65    4.6039   46.039    10.7      10     4.6039

4 0
2 years ago
What scale model proves the initial concept?
Tju [1.3M]

Answer: A prototype

Explanation:

5 0
3 years ago
Other questions:
  • An AX ceramic compound has the rock salt crystal structure. If the radii of the A and X ions are 0.137 and 0.241 nm, respectivel
    10·1 answer
  • Air in a 10 ft3 cylinder is initially at a pressure of 10 atm and a temperature of 330 K. The cylinder is to be emptied by openi
    10·2 answers
  • Suppose there are 76 packets entering a queue at the same time. Each packet is of size 5 MiB. The link transmission rate is 2.1
    5·1 answer
  • Whats is the purpose of the stator winding​
    13·1 answer
  • How to Cancel prescription
    12·1 answer
  • The W16x50, steel beam below has a span of 26' and is subjected to a 2.3 k/ft uniform distributed loading. If a 8 kip load is al
    8·1 answer
  • Describe the role of C-S-H in providing strength for cement. Discuss which compounds produce C-S-H and why balancing the amounts
    13·1 answer
  • If i build thing a and thing a builds thing b did i build thing b
    5·2 answers
  • What material are the rocker/valve cover gaskets made out of?
    5·1 answer
  • Question 1 A design team completes their high-fidelity prototype of a responsive website. Before they hand off designs to the en
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!