1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
8_murik_8 [283]
2 years ago
15

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()
Computers and Technology
1 answer:
Aleksandr-060686 [28]2 years ago
4 0

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.

You might be interested in
Why are open standards important in the data communications industry?
IrinaK [193]

They enable interoperability between software and hardware from different vendors.

5 0
3 years ago
I've this assignment due before 7 am. Please help, me.
Alenkasestr [34]

Answer:

An observation: Java does not support true multi-dimensional arrays; rather, it supports 1-dimensional arrays, where each element can itself be another 1-dimensional array. The difference is the way memory is allocated, where a[i][j] differs from a[i,j].

Explanation:

5 0
3 years ago
Differences between windows xp and windows vista
krek1111 [17]
Well since Windows XP runs on Windows 2000 technology,it would be "slow".Also that Windows XP had MSN,which expired 15 years ago,but the good thing about Windows XP is that it can connect to the internet via WiFi without the computers hardware used for WiFi(PC only).Also that Windows XP has a logo on the start-up screen.Windows Vista on the other hand, doesn't have a logo on the start-up screen,but shows a Windows Vista animated logo atfer the start-up screen.Also that some people named Windows Vista "The first Windows 7".But somewhat,Windows Vista ran faster than Windows XP at starting up.Windows Vista was old,but it sold better than Windows XP.
6 0
2 years ago
Tamera was responding to a complaint that one of the employees is having problems with the wired network connection on their lap
WARRIOR [948]

Answer:

tamera like from sister sister hehe

Explanation:

sorry i dont know the awnser

3 0
3 years ago
Create a lottery game application. Generate three random numbers (see Appendix D for help in doing so), each between 0 and 9. Al
Pachacha [2.7K]

The question is not complete! Here is the complete question and its answer!

Create a lottery game application. Generate three random numbers (see Appendix D for help in doing so), each between 0 and 9. Allow the user to guess three numbers. Compare each of the user’s guesses to the three random numbers and display a message that includes the user’s guess, the randomly determined three-digit number, and the amount of money the user has won as follows:

no matches: 0

any one matching: 10$  

two matching: 1000$  

three matching: 100000$  

Code with Explanation:

#include <iostream>

using namespace std;

int main()

{

int matches=0;

int guess_1, guess_2, guess_3;

int num_1, num_2, num_3;

// get 3 digits from the user

cout<<"Enter first guess digit 0 to 9"<<endl;

cin>>guess_1;

cout<<"Enter second guess digit 0 to 9"<<endl;

cin>>guess_2;

cout<<"Enter third guess digit 0 to 9"<<endl;

cin>>guess_3;

// every time program runs srand() generates new random numbers and rand()%10 makes sure that number is single digit 0 to 9

srand(time(NULL));

num_1=rand()%10;

cout<<"First lottery digit: "<<num_1<<endl;

num_2=rand()%10;

cout<<"Second lottery digit: "<<num_2<<endl;

num_3=rand()%10;

cout<<"Third lottery digit: "<<num_3<<endl;

// store random generated numbers and guess numbers in arrays to compare them

int num[3]= {num_1,num_2,num_3};

int guess[3]={guess_1,guess_2,guess_3};

// compare the arrays to find out how many are matching

   for(int i=0; i<3; i++)

   {

 for(int j=0; j<3; j++)

 {

  if(num[i]==guess[j])

  {    

   matches = matches + 1;

  }

 }

}

cout << "Total Matches are: " <<matches << endl;

// display reward according to the number of matches

if (matches==0)

cout<<"you won: $0"<<endl;

if (matches==1)

cout<<"you won: $10"<<endl;

if (matches==2)

cout<<"you won: $1000"<<endl;

if (matches==3)

cout<<"you won: $100000"<<endl;

return 0;

}

Output:

Enter first guess digit 0 to 9

7

Enter second guess digit 0 to 9

1

Enter third guess digit 0 to 9

5

First lottery digit: 3

Second lottery digit: 7

Third lottery digit: 2

Total Matches are: 1

You won: $10

Enter first guess digit 0 to 9

7

Enter second guess digit 0 to 9

3

Enter third guess digit 0 to 9

4

First lottery digit: 5

Second lottery digit: 4

Third lottery digit: 7

Total Matches are: 2

You won: $1000

5 0
3 years ago
Other questions:
  • Explain why this scenario points towards a potential problem with BIOS.
    10·2 answers
  • What is a critique of the feature detector model of object recognition?​?
    8·1 answer
  • What can I do if my mouse on my laptop keeps freezing on me for 5 minutes
    11·1 answer
  • Why computer process faster than humans?​
    10·2 answers
  • 1. Which of the following statements are true about routers and routing on the Internet. Choose two answers. A. Protocols ensure
    9·2 answers
  • What are the three basic classes of application
    14·2 answers
  • Aside from human user types, there are non human user groups. Known as account types, __________ are implemented by the system t
    10·1 answer
  • 8.11 LAB: Filter and sort a list
    8·1 answer
  • It's important to understand that even information systems that do not use computers
    14·1 answer
  • List any three positive impact of a computer​
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!