At Westonci.ca, we make it easy for you to get the answers you need from a community of knowledgeable individuals. Join our platform to get reliable answers to your questions from a knowledgeable community of experts. Experience the convenience of finding accurate answers to your questions from knowledgeable experts on our platform.

Help me understand why it does not loop correctly and how to make the converter a continious loop? What am I doing wrong and how can I fix it? PYTHON

Code
def metric_english ():

print("Select metric units to convert to English equivilant: ")
print("For kilometers type: 1")
print("For meters type: 2")
print("For centimeters type: 3")
print("\n")
metEng = input("Choose metric units to convert (1, 2, 3): ")
print("\n")
print("Convert to which English units: ")
print("For miles type: 1")
print("For feet type: 2")
print("For inches type: 3")
print("\n")
metEng1 = input("Choose target English units (1, 2, 3): ")
print("\n")
if (metEng and metEng1 == 1):
num1 = input("Enter the number of miles to conver to kilometers: ")
convert2 = num1 * 0.62137
print("RESULT: ", num1, " kilometers = ", convert2, " miles")
elif (metEng and metEng1 == 2):
num1 = input("Enter the number of feet to convert to meters: ")
convert2 = num1 * 0.3048
print("RESULT: ", num1, "meters = ", convert2, " feet")
elif (metEng and metEng1 == 3):
num1 = input("Enter the number of inches to convert to centimeters: ")
convert2 = num1 * 2.54
print("RESULT: ", num1, "centimeters = ", convert2, " feet")
elif (metEng == 1 and metEng1 == 2):
num1 = input("Enter the number of feet to conver to kilometers: ")
convert2 = num1 * 1000
print("RESULT: ", num1, " meters = ", convert2, " miles")
elif (metEng == 1 and metEng1 ==3):
num1 = input("Enter the number of inches to conver to kilometers: ")
convert2 = num1 * 100000
print("RESULT: ", num1, " centimeters = ", convert2, " miles")
elif (metEng == 2 and metEng1 == 1):
num1 = input("Enter the number of miles to convert to meters: ")
convert2 = num1 * 0.0003048
print("RESULT: ", num1, " kilometers = ", convert2, "miles ")
elif (metEng == 3 and metEng1 == 2):
num1 = input("Enter the number of feet to conver to centimeters: ")
convert2 = num1 * 0.0254
print("RESULT: ", num1, " meters = ", convert2, " inches")
elif (metEng == 2 and metEng1 == 3):
num1 = input("Enter the number of inches to conver to meters: ")
convert2 = num1 * 30.48
print("RESULT: ", num1, " centimeters = ", convert2, " feet")
elif (metEng == 3 and metEng1 == 1):
num1 = input("Enter the number of miles to convert to centimeters: ")
convert2 = num1 * 2.54 #add exponent
print("RESULT: ", num1, " kilometers = ", convert2, " inches")



def main ():

print("\nWelcome to the English/Metric conversion utility.")
print("This utility allows you to convert between English units (miles, feet, inches) and metric units (kilometers, metters, centimeters). ")
print("\n")
print("--------------------------------------------------------")
print("\n")
print("Which direction would you like to convert: ")
print("For English Metric type: 1")
print("For Metric to English type: 2")
print("To Quit type: 3")
print("\n")
ans = int(input("Input your answer (1, 2, 3): "))
while ans <= 3:
if (ans == 1):
english_metric()
if (ans == 2):
metric_english()
if (ans == 3):
print("Thanks for using our converter. Goodbye!")
print("\n")
break
else:
print(errorMessage)

main()


Sagot :

Answer:

The control loop responds to

the overcharged VOUT with a skipped pulse to

regulate VOUT to the correct DC voltage. Other

converters may respond differently when the

minimum on-time is violated. For example, the

fSW may begin to decrease or VOUT may become

regulated to a higher voltage

Explanation:

If you are trying to make a loop run a certain number of time in Python, then...

To repeat something a certain number of times, you may:

1. Use range or xrange for i in range(n): # do something here.

2. Use while i = 0 while i < n: # do something here i += 1.

3. If the loop variable i is irrelevant, you may use _ instead for _ in range(n): # do something here _ = 0 while _ < n # do something here _ += 1.

Thanks for using our platform. We aim to provide accurate and up-to-date answers to all your queries. Come back soon. Thanks for using our platform. We aim to provide accurate and up-to-date answers to all your queries. Come back soon. Get the answers you need at Westonci.ca. Stay informed by returning for our latest expert advice.