Question: 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:
Data is passed from the function call in the main function to the function definition.The code block in the function definition should only calculate the conversion and display it #This program converts positive input of miles into Kilometers
#If input is negative three times in a row
#the program exits
def milesToKm miles:
return miles
def main :
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 milesToKm miles
printmiles'miles is equal to formatmilesToKilometersf'Kilometers'
if Invalidattempts:
printyou can not enter further data'
main
Need Data to be passed from the function call in the main function to the function definition.The code block in the function definition should only calculate the conversion and display it No use of Returnbreakexit is allowed
This is the third time i ask this question. Please No use of Returnbreakexit is allowed
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
