Respuesta :
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
In this exercise we have to use the computer language knowledge in python to write the code.
This code can be found in the attachment.
So we have what the code in python is:
def main():
number = int(input('Enter a positive integer: '))
finalSum = addition(number)
print("The integral of this number is ", finalSum, ".")
def addition(num):
if num == 1:
return 1
else:
return num + addition(num-1)
main()
See more about python at brainly.com/question/18502436
