Answered step by step
Verified Expert Solution
Question
1 Approved Answer
def main ( ) : milesToKm ( ) FahToCel ( ) GalToLit ( ) def milesToKm ( ) : Invalid _ attempts = 0 while
def main:
milesToKm
FahToCel
GalToLit
def milesToKm :
Invalidattempts
while Invalidattempts :
miles floatinputEnter how many miles you want converted:
if miles :
printYou can not enter a negative number goodbye, William.
InvalidattemptsInvalidattempts
else:
milesToKilometers miles
printWilliam miles, 'Miles is equal to Kilometers: formatmilesToKilometersf "isn't that amazing!"
if Invalidattempts:
printyou can not enter further data'
def FahToCel:
Invalidattempts
while Invalidattempts :
fahrenheit floatinputWilliam Please enter the fahrenheit temperature you want converted:
if fahrenheit :
printYou can not enter temp greater than goodbye, William.
InvalidattemptsInvalidattempts
else:
fahrenheitToCelsius fahrenheit
printWilliam fahrenheit, 'fahrenheit is equal to Celsius: formatfahrenheitToCelsiusf "isn't that amazing!"
if Invalidattempts:
printyou can not enter further data'
Modify the program above so that data will be passed from the function call in main to the function definition.
The code block in the function definition should only calculate the conversion and show it
Step 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