Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Need help on parts A, B, and D. C is correct already. Exercise 1 a) Write a function that converts degrees Farenheit into Celsius. To
Need help on parts A, B, and D. C is correct already.
Exercise 1 a) Write a function that converts degrees Farenheit into Celsius. To convert temperature in degrees Fahrenheit to Celsius, subtract 32 and multiply by 5/9. In [ ] : b) Write a function to convert a distance from miles to kilometers. (Note: 1mi=1.609344km.) In [4]: def miles_to_kilometers(miles): kilometers = miles 1.609344 return kilometers In [ ] : c) Write a new function miles_km_fix, based on miles_km, that also checks the sign of its parameter dist . If dist is negative, the function should return the string 'distance cannot be negative'. Otherwise, the function should behave like miles_km .. In [5]: def miles_km_fix(dist): if distStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started