3. Write a function that takes, as arguments, three numbers, and returns their average. Round the values to the nearest tenth. Name this function calculate Average (p1, p2, p3). For example, >>>calculate Average (2.5, 3.5, 9) average of those 3 values, using decimal division. Round the values to the nearest tenth. Name your function get Average String (p1, p2, p3). For example, >>>get Average String (1.5, 3.5, 4) should return the string “The average value is 3.0.” Your sentence must EXACTLY match
def calculateAverage(p1,p2,p3): return round((p1 + p2 + p3) / 3.0,1) def getAverageString(p1,p2,p3): avg = round((p1 + p2 + p3) / 3.0,1) return "The average value is "+str(avg)+"." # Testing print(calculateAverage(2.5,3.5,9)) print(getAverageString(1.5,3.5,4))
3. Write a function that takes, as arguments, three numbers, and returns their average. Round the...
Write a function that takes, as arguments, three numbers, and returns their average. Round the values to the nearest tenth. Name this function calculate Average (p1, p2, p3). For example, >>>calculate Average (2.5, 3.5, 9)
in python Write a function, named max_of_two, that takes two numbers as arguments and returns the largest of the two values. (Note, this function is actually already provided in Python as max. Do not use the provided function; reason through the logic yourself).
Using python, Write a function max3 that takes three numbers as its arguments and returns the greatest of these three numbers. Your submitted file for this problem should include (a) function definition, obviously, and (b) the code that calls that function (for this problem you do not have to package that calling code into the main() function although you may if you want to), so that if I run your *.py file it computes and prints something (e.g. few test...
Write a decorator function in python that takes in 3 strings as arguments and returns them in reverse order.
Write a Python function, called counting, that takes two arguments (a string and an integer), and returns the number of digits in the string argument that are not the same as the integer argument. Include a main function that inputs the two values (string and integer) and outputs the result, with appropriate labelling. You are not permitted to use the Python string methods (such as count(), etc.). Sample input/output: Please enter a string of digits: 34598205 Please enter a 1-digit...
Using MATLAB Please Write a MATLAB function that takes coord natos of four points as inputs and returns the coord nates of ntersection of the line passing through ooints 1 and 2 and the line passing through points 3 and 4. For function name and inout arguments, use: P line_int(P1, P2, P3, P4) The function should be able to handle row or column vector entries. This function will use a sub-function called line_eq. This sub-function takes coordinates of two points...
Python Language Create a module (1 mark) a) Create a function that takes three (3) arguments (1 mark) i) Name it whatever you’d like (1 mark) ii) It will return a dictionary with the following keys (1 mark) (1) Error => gives error message or empty string if not (1 mark) (2) Result => gives result or empty string if no result (1 mark) b) Ensure that all three arguments are of String (str) datatype (1 mark) i) Return an...
Write a function named words_in_both that takes two strings as parameters and returns a set of the words contained in both strings. You can assume all characters are letters or spaces. Capitalization shouldn't matter: "to", "To", "tO", and "TO" should all count as the same word. The words in the set should be all lower-case. For example, if one string contains "To", and the other string contains "TO", then the set should contain "to". You can use Python's split() funciton,...
b) (2.5 marks) Write a Matlab user defined function that takes the letter grades (i.e. AABBC) as input and returns if the student entitled to the honor list or not. The student is considered in the honor s f he or she satisfies the following three conditions: a. An average GPA of 3.5 and above and b. At least two classes with A mark and e. no class with a mark less than C (i.e. no D or F) The...
Write a Python function called more() that takes three string inputs and outputs a string Formally, the function signature and output are given by rucharist, char: str words str) > str Use the same names for the input arguments as shown above Note that charl and char2 will always be a string of length 1 (ie, it is a single character. The function checks which of charl or char2 appears more often in the word string and returns that character...