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
A heat pump receives heat from a lake that has an average wintertime temperature of 6o C and supplies heat into a house having a
Dafna1 [17]

Answer:

a) \dot W = 1.062\,kW

Explanation:

a) Let consider that heat pump is reversible, so that the Coefficient of Performance is:

COP_{HP} = \frac{T_{H}}{T_{H}-T_{L}}

COP_{HP} = \frac{298.15\,K}{298.15\,K-279.15\,K}

COP_{HP} = 15.692

The minimum heat received by the house must be equal to the heat lost to keep the average temperature constant. Hence:

\dot Q_{H} = 60000\,\frac{kJ}{h}

The minimum power supplied to the heat pump is:

\dot W = \frac{\dot Q_{H}}{COP}

\dot W = \frac{\left(60000\,\frac{kJ}{h}  \right)\cdot \left(\frac{1\,h}{3600\,s}  \right)}{15.692}

\dot W = 1.062\,kW

5 0
3 years ago
In a production turning operation, the foreman has decreed that a single pass must be completed on the cylindrical workpiece in
stellarik [79]

Answer:

V = 125.7m/min

Explanation:

Given:

L = 400 mm ≈ 0.4m

D = 150 mm ≈ 0.15m

T = 5 minutes

F = 0.30mm ≈ 0.0003m

To calculate the cutting speed, let's use the formula :

T = \frac{pi* D * L}{V*F}

We are to find the speed, V. Let's make it the subject.

V = \frac{pi* D * L}{F*T}

Substituting values we have:

V = \frac{pi* 0.4 * 0.15}{0.0003*5}

V = 125.68 m/min ≈ 125.7 m/min

Therefore, V = 125.7m/min

7 0
3 years ago
What’s another name for a service overcurrent device?
alexandr402 [8]
Overcurrent protective devices, or OCPDs
4 0
3 years ago
Ronny wants to calculate the mechanical advantage. He needs to determine the length of the effort arm and the length of the load
kakasveta [241]

Answer:

I hope it's helpful.

Explanation:

Simple Machines

Experiments focus on addressing areas pertaining to the relationships between effort force, load force, work, and mechanical advantage, such as: how simple machines change the force needed to lift a load; mechanical advantages relation to effort and load forces; how the relationship between the fulcrum, effort and load affect the force needed to lift a load; how mechanical advantage relates to effort and load forces and the length of effort and load arms.

Through investigations and models created with pulleys and levers, students find that work in physical terms is a force applied over a distance. Students also discover that while a simple machine may make work seem easier, in reality the amount of work does not decrease. Instead, machines make work seem easier by changing the direction of a force or by providing mechanical advantage as a ratio of load force to effort force.

Students examine how pulleys can be used alone or in combination affect the amount of force needed to lift a load in a bucket. Students find that a single pulley does not improve mechanical advantage, yet makes the effort applied to the load seem less because the pulley allows the effort to be applied in the direction of the force of gravity rather than against it. Students also discover that using two pulleys provides a mechanical advantage of 2, but that the effort must be applied over twice the distance in order to gain this mechanical advantage Thus the amount of work done on the load force remains the same.

Students conduct a series of experiments comparing the effects of changing load and effort force distances for the three classes of levers. Students discover that when the fulcrum is between the load and the effort (first class lever), moving the fulcrum closer to the load increases the length of the effort arm and decreases the length of the load arm. This change in fulcrum position results in an increase in mechanical advantage by decreasing the amount of effort force needed to lift the load. Thus, students will discover that mechanical advantage in levers can be determined either as the ratio of load force to effort force, or as the ratio of effort arm length to load arm length. Students then predict and test the effect of moving the fulcrum closer to the effort force. Students find that as the length of the effort arm decreases the amount of effort force required to lift the load increases.

Students explore how the position of the fulcrum and the length of the effort and load arms in a second-class lever affect mechanical advantage. A second-class lever is one in which the load is located between the fulcrum and the effort. In a second-class lever, moving the load changes the length of the load arm but has no effect on the length of the effort arm. As the effort arm is always longer than the load arm in this type of lever, mechanical advantage decreases as the length of the load arm approaches the length of the effort arm, yet will always be greater than 1 because the load must be located between the fulcrum and the effort.

Students then discover that the reverse is true when they create a third-class lever by placing the effort between the load and the fulcrum. Students discover that in the case of a third-class lever the effort arm is always shorter than the load arm, and thus the mechanical advantage will always be less than 1. Students also create a model of a third-class lever that is part of their daily life by modeling a human arm.

The CELL culminates with a performance assessment that asks students to apply their knowledge of simple machine design and mechanical advantage to create two machines, each with a mechanical advantage greater than 1.3. In doing so, students will demonstrate their understanding of the relationships between effort force, load force, pulleys, levers, mechanical advantage and work. The performance assessment will also provide students with an opportunity to hone their problem-solving skills as they test their knowledge.

Through this series of investigations students will come to understand that simple machines make work seem easier by changing the direction of an applied force as well as altering the mechanical advantage by afforded by using the machine.

Investigation focus:

Discover that simple machines make work seem easier by changing the force needed to lift a load.

Learn how effort and load forces affect the mechanical advantage of pulleys and levers.

8 0
2 years ago
Air enters a tank through an area of 0.2 ft2 with a velocity of 15 ft/s and a density of 0.03 slug/ft3. Air leaves with a veloci
Mademuasel [1]

Answer:

please find attached.

Explanation:

4 0
3 years ago
Other questions:
  • 3. Air at 1 atm and 20 0 C flows tangentially on both sides of a smooth flat plate of width W=10 ft and length L=10 ft in the di
    8·1 answer
  • A 179 ‑turn circular coil of radius 3.95 cm and negligible resistance is immersed in a uniform magnetic field that is perpendicu
    11·1 answer
  • A random sample of 5 hinges is selected from a steady stream of product from a punch press, and the a. b. proportion nonconformi
    12·1 answer
  • Write a script (Program 2) to perform t he following matrix operations. Use output commands to clearly output each problem with
    15·1 answer
  • Has anyone lost faith in humanity ✌️
    7·1 answer
  • Is the science of measurement
    13·2 answers
  • For a bolted assembly with eight bolts, the stiffness of each bolt is kb = 1.0 MN/mm and the stiffness of the members is km = 2.
    14·1 answer
  • Motors are used to convert electrical energy into mechanical work and the output mechanical work of a motor is rated in horsepow
    9·1 answer
  • A ruptured desiccant bag in a reciever-driver is usually caused by what?​
    13·1 answer
  • Technician a s ays a shorted circuit can generate excessive heat. technician b says a shorted circuit will cause the circuit pro
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!