Answered step by step
Verified Expert Solution
Link Copied!

Question

00
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

image text in transcribed

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 dist

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions