Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

def main ( ) : milesToKm ( ) FahToCel ( ) GalToLit ( ) def milesToKm ( ) : Invalid _ attempts = 0 while

def main():
milesToKm ()
FahToCel()
GalToLit()
def milesToKm ():
Invalid_attempts=0
while Invalid_attempts <3:
miles = float(input('Enter how many miles you want converted: '))
if miles <0:
print('You can not enter a negative number goodbye, William.')
Invalid_attempts=Invalid_attempts+1
else:
milesToKilometers = miles *1.6
print('William,', miles, 'Miles is equal to Kilometers:', format(milesToKilometers,',.2f'), "isn't that amazing!")
if Invalid_attempts==3:
print('you can not enter further data')
def FahToCel():
Invalid_attempts=0
while Invalid_attempts <3:
fahrenheit = float(input('William, Please enter the fahrenheit temperature you want converted: '))
if fahrenheit >1000:
print('You can not enter temp greater than 1000 goodbye, William.')
Invalid_attempts=Invalid_attempts+1
else:
fahrenheitToCelsius =(fahrenheit -32)*5/9
print('William,', fahrenheit, 'fahrenheit is equal to Celsius:', format(fahrenheitToCelsius,',.2f'), "isn't that amazing!")
if Invalid_attempts==3:
print('you 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

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Automating Access Databases With Macros

Authors: Fish Davis

1st Edition

1797816349, 978-1797816340

More Books

Students also viewed these Databases questions

Question

Why is the System Build Process an iterative process?

Answered: 1 week ago