Question: paython TASKS ( EIGHT Tasks ) 1 . Write a function called sum _ from _ one ( ) that takes an integer and adds
paython TASKS EIGHT Tasks
Write a function called sumfromone that takes an integer and adds up and returns
all the integers from up to that number.
Signature:
def sumfromonen:
# your code here
return sum
Examples:
sumfromone
sumfromone
Write a function called sumfivers that takes an integer and adds up and returns all
the multiples of that are less than or equal to that number.
Signature:
def sumfiversn:
# your code here
return sum
Examples:
sumfivers
sumfivers #
Write a function called countfivers that takes an integer and counts and returns
how many multiples of there are that are less than or equal to that number.
Signature:
def countfiversn:
# your code here
return sum
Examples:
countfivers
countfivers
countfivers
Write a function called sumfromX that takes two integers, bottom and top, and
adds up and returns all the integers from bottom up to and including top.
Signature:
def sum fromXbottom top:
# your code here
return
Examples:
sumfromX
sumfromX
sumfromX
Write a function called sumdivisorsfinds the sum of all the proper factors of an
integer. Proper factors are all the factors of an integer other than the number, itself.
Signature:
def sumdivisorsn:
# your code here
return
Examples:
sumdivisors #only divides itself
sumdivisors #
sumdivisors #
MORE TASKS ON NEXT PAGE
Write a function called mysterysum that takes one integer parameter, n and
calculates a "sum" as follows:
For all integers from up to but not including n
For even numbers add the square of the number
For odd numbers, add twice the number
Signature:
def mysterysumn:
# your code here
return
Examples:
mysterysum
mysterysum
Write a function called mysterysum that takes one integer parameter, n and
calculates a "sum" as follows:
For all integers from up to but not including n
For even numbers, add the square of half the number
NOTE: Be sure you use integers only!
For odd numbers, add the square of the number
Signature:
def mysterysumn:
# your code here
return
Examples:
mysterysum
mysterysum
Write a function called biggermystery that takes one integer parameter, n and
determines which mystery function above generates a larger result.
"SAME" if the two results are the same
"ONE" if mysterysum generates a larger result
"TWO" if mysterysum generates a larger result
Signature:
def biggermysteryn:
# your code here
return
Examples:
biggermystery TWO
biggermystery ONE
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
