Question: Question 1: python programming, using python 3. a) Write a function mh2kh(s) that given the speed, s, expressed in miles/hour returns the same speed expressed
Question 1:
python programming, using python 3.
a) Write a function mh2kh(s) that given the speed, s, expressed in miles/hour returns the same speed expressed in kilometres/hour.
b) Two numbers a and b are called pythagorean pair if both a and b are integers and there exists an integer c such that a2 + b2 = c2. Write a function pythagorean_pair(a,b) that takes two integers a and b as input and returns True if a and b are pythagorean pair and False otherwise.
How the testing of the question looks like:
testing Question 1a) >>>
>>> mh2kh(5)
8.0467
>>> >>> mh2kh(110.4)
177.67113600000002
# testing Question 1b) >>>
>>> pythagorean_pair(2,2)
False >>> pythagorean_pair(6,2)
False >>> pythagorean_pair(6,8) True >>> pythagorean_pair(300,-400)
True
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
