Question: # RQ1 Write a function day_name that converts an integer number 0 to 6 into the name of a day. Assume day 0 is
# RQ1 """ Write a function day_name that converts an integer number 0 to 6 into the name of a day. Assume day 0 is Sunday. Your function should return error message if the arguments to the function are not valid. """ def day_name(n): """ >>> day_name(3) 'Wednesday' >>> day_name(6) 'Saturday' >>> day_name(42) 'Invalid argument' """ "*** YOUR CODE HERE ***" # RQ2 def two_of_three(a, b, c): """Return using one-liner x*x + y*y, where x and y are the two largest members of the positive numbers a, b, and c. >>> two_of_three(1, 2, 3) 13 >>> two_of_three(5, 3, 1) 34 >>> two_of_three(10, 2, 8) 164 >>> two_of_three(5, 5, 5) 50 """ return _____ # RQ3 def largest_factor(n): """Return the largest factor of n that is smaller than n. >>> largest_factor(15) # factors are 1, 3, 5 5 >>> largest_factor(80) # factors are 1, 2, 4, 5, 8, 10, 16, 20, 40 40 """ "*** YOUR CODE HERE ***" # RQ4 """ Here we define a function main that takes a function and and a *args which is used to pass a variable number of arguments. The function main returns the application of f to *args. The first doctest should pass without modification. Add definitions for sum and mult to pass the tests.""" def main(f, *args): """ >>> main(max,1,2,4) 4 >>> main(sum,1,2,4) 7 >>> main(mult,1,2,4) 8 """ return f(*args) import doctest if __name__ == "__main__": doctest.testmod(verbose=True)
need solution for this questions
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
