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
The A-36 solid steel shaft is 3.3 m long and has a diameter of 50 mm. It is required to transmit 35 kW of power from the engine
spin [16.1K]

Answer:

Explanation:

Answer is in the following attachment

8 0
3 years ago
which type of building construction can include materials with no fire-resistance ratings in limited quantities?
hammer [34]

The type of type of building construction can include materials with no fire-resistance ratings in limited quantities is type 2.

Although many buildings appear to be similar at first appearance, their cost and durability—particularly in an emergency—are affected by the underlying materials. Building codes categorize all structures into Types 1 through 5, and each Type discloses important details like fire-resistance.

Some contemporary structures are now stronger and less expensive to construct. Engineered wood and synthetic plastics, which burn readily, cause quick collapses and present significant risks for firefighters.

Type 1 constructions, which are the most fire-resistant buildings, are made of shielded steel and concrete because they can sustain high temperatures without collapsing. Type 5 constructions, on the other hand, are the least fire-resistant since they are built of flammable materials, are lightweight, and they burn out quickly. Type 2 constructions, modern structures with metal roofs and tilt-slab or reinforced masonry walls.

To know more about fire-resistance click on the link:

brainly.com/question/14447720

#SPJ4

6 0
1 year ago
Find the magnitude of the steady-state response of the system whose system model is given by dx(t)/dt+ x(t)-f(t), where f(t) 2co
NISA [10]

This question is incomplete, the complete question is;

Find the magnitude of the steady-state response of the system whose system model is given by

dx(t)/dt + x(t) = f(t)

where f(t) = 2cos8t.  Keep 3 significant figures

Answer: The steady state output x(t) = 0.2481 cos( 8t - 45° )

Explanation:

Given that;

dx(t)/dt + x(t) = f(t)  where f(t) = 2cos8t

dx(t)/dt + x(t) = f(t)

we apply Laplace transformation on both sides

SX(s) + x(s) = f(s)

(S + 1)x(s) = f(s)

f(s) / x(s) = S + 1

x(s) / f(s) = 1 / (S + 1)

Therefore

transfer function = H(s) = x(s)/f(s) = 1/(S+1)

f(t) = 2cos8t →   [ 1 / ( S + 1 ) ]   →  x(t) = Acos(8t - ∅ )

A = Magnitude of steady state output

S = jw

S = j8

so

A = 2 × 1 / √( 8² + 1 ) = 2 / √ (64 + 1 )

A = 2/√65 = 0.2481

∅ = tan⁻¹( 1/1) = 45°

therefore The steady state output x(t) = 0.2481 cos( 8t - 45° )

7 0
3 years ago
Robots make computations and calculations using what part
EastWind [94]

Answer:

Thierry mother board chip

Explanation:hi

8 0
3 years ago
What is the most important task of a spark plug?
Andrews [41]

Answer:

to break the side window of a car

Explanation:

7 0
3 years ago
Other questions:
  • 2. When manipulating your pedals, you should use your
    7·2 answers
  • 2.7. The term route of entry on an SDS refers to the way a
    13·1 answer
  • When were dresses made
    10·1 answer
  • Prove that "a perfect conductor cannot contain an electrostatic field within it".​
    14·1 answer
  • Consider a thermal energy reservoir at 1500 K that can supply heat at a rate of 150,000 kJ/h. Determine the exergy of this suppl
    15·1 answer
  • On Saturday, December 31, the company's owner provided ten hours of service to a customer. The company bills $100 per hour for s
    8·1 answer
  • An ideal fluid flows through a pipe made of two sections with diameters of 1.0 and 3.0 inches, respectively. The speed of the fl
    13·1 answer
  • What plane is this? and when was it made?
    11·1 answer
  • A rope is wrapped three and a half times around a cylinder. Determine the range of force T exerted on
    15·1 answer
  • What are the corresponding minimum and maximum velocities that the rocket experiences? Express your answer as two numbers separa
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!