Question: Write a function that converts light - years to miles. Your function should take as input a numerical value representing the number of light -
Write a function that converts lightyears to miles. Your function should take as input a numerical
value representing the number of lightyears. Your function should then convert this value to miles, and
return the result as its output. It should also print the result of the conversion in the format shown below.
Your function should make sure that the input is nonnegative. If the input is negative, an error message
should be displayed, your output variable should be returned as Not a Number as shown in class, and your
function should return early. Examples of expected input and output:
lightyear
ans
lightyear
ans
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
