1.)Give codes for a Python program with a function that accepts three parameterstwo integers and a mathematical...
Question:
- 1.)Give codes for a Python program with a function that accepts three parameters—two integers and a mathematical operators (i.e. +, -, /, or *). The function calculate and return the appropriate result.
For example, if the function is passed 7, 2, and +, it should return 9. If it's passed 4, 5, and *, it should return 20.
2.) Give codes for a Python program with a function that sums the numbers in any range of a Python list using a loop. The function should accept as a parameter a python list, and the start index and ending index of the desired range, and return the sum.
For example, given the list [ 1, 2, 3, 4, 5, 6 ], if the starting index is 2 and the ending index is 4, then the function should return 3 + 4 + 5 = 12.
3.) Give codes for a Python program with a function that accepts two points on a plane as tuples and uses the Pythagorean Theorem to calculate and return the distance between them.
Microeconomics An Intuitive Approach with Calculus
ISBN: 978-0538453257
1st edition
Authors: Thomas Nechyba