##### Question

In: Computer Science

# Having indentation problems. I have no idea why one of my breaks are screwing up. This...

Having indentation problems. I have no idea why one of my breaks are screwing up. This should be a easy fix and thumbs up for you lads out there. here's my code. Ill leave a comment on where the break problem is. Also if you could do be a solid and run it to see if it executes. Thanks!

Python Code:

def to_euro(dollar):
return float(dollar)*0.81;

def to_yen(dollar):
return float(dollar)*106.45;

def to_peso(dollar):
return float(dollar)*18.58;

def main():
while(1):
x=input("Enter 1 for Euro, 2 for Japanese Yen, 3 for Mexican Peso: ");
x=int(x);
if(x==1 or x==2 or x==3):
break;
else:
print("Error: Invalid choice");
while(1):
y=input("Enter US Dollar: ");
y=float(y);
if(y<0):
print("Can't be negetive");
else:
break; #here is the error
if(x==1):
print("Its is converted to ",to_euro(y)," Euro" );
elif(x==2):
print("Its is converted to ",to_yen(y)," Yen" );
else:
print("Its is converted to ",to_peso(y)," Peso" );

main()


## Solutions

##### Expert Solution

Explanation:

Here is the code which has the correct indentation, the error was there because, the code was not inside the while loop.

Code:

def to_euro(dollar):
return float(dollar)*0.81

def to_yen(dollar):
return float(dollar)*106.45

def to_peso(dollar):
return float(dollar)*18.58

def main():

while(1):
x=input("Enter 1 for Euro, 2 for Japanese Yen, 3 for Mexican Peso: ")
x=int(x)

if(x==1 or x==2 or x==3):
break
else:
print("Error: Invalid choice")

while(1):
y=input("Enter US Dollar: ")

y=float(y)

if(y<0):
print("Can't be negetive")
else:
break

if(x==1):
print("Its is converted to ",to_euro(y)," Euro" )
elif(x==2):
print("Its is converted to ",to_yen(y)," Yen" )
else:
print("Its is converted to ",to_peso(y)," Peso" )

main()

Output:

PLEASE COMMENT IF YOU NEED ANY HELP!

## Related Solutions

##### Hello, I'm having a hard time solving these problems because I have no idea on what...
Hello, I'm having a hard time solving these problems because I have no idea on what to do with accrued interest. Help is highly appreciated! On March 1, 2015, Bowan Corporation issued 6% bonds dated February 1, 2015, the face amount of \$700,000. The bonds were sold for the present value of the bonds on March 1, 2015 plus one-month accrued interest. The bonds mature on January 31, 2018. Interest is paid semiannually on July 31 and January 31. Bowan's...
##### Hello, I want to write my math solutions in LATEX but I have no idea how...
Hello, I want to write my math solutions in LATEX but I have no idea how to do it. I want an example code written in LATEX for the solution of math problem "If x and y are rational, then x+y is also rational." I have the solution but I need the LATEX code so that I can understand how to write in LATEX. Thank You!
##### Helou from Croatia(Sorry for my bad english). I am having problems with fluid mechanichs. I wonder...
Helou from Croatia(Sorry for my bad english). I am having problems with fluid mechanichs. I wonder if maybe someone can help me with strategy of solving this type of tasks and maybe write and explain all of the formulas that I need for solving all of the types for fluid statics and dynamics? Thank you.
##### This is my C language code. I have some problems with the linked list. I can't...
This is my C language code. I have some problems with the linked list. I can't store the current. After current = temp, I don't know how to move to the next node. current = current-> next keeps making current into NULL. #include #include #include #include struct node{int data; struct node *next;}; int main() {     struct node *head, *current, *temp, *trash;     srand(time(0));     int randNumber = rand()%51;     if(randNumber != 49)     {         temp = (struct node*)malloc(sizeof(struct node));         current = (struct node*)malloc(sizeof(struct node));...
##### I have a project due and am having problems compiling a program: The only program I...
I have a project due and am having problems compiling a program: The only program I have written is check.c everything else is given and correct. Can you modify check.c to simply print out the chessboard, in other words, to get it to compile by any means thank you. The only thing you have to modify again is check.c nothing else. Just get it to print something thanks. program chess.c #include #include #include "chess.h" void get_valid_move(int mover) { int x_from,...
##### 25) Kathy has been having problems with her staff taking longer than normal breaks in a...
25) Kathy has been having problems with her staff taking longer than normal breaks in a breakroom with very comfortable chairs and table and they invite employee to linger. Kathy ask you to design uncomfortable chairs and tables to discourage employees from lingering. Are there any moral dilemmas, if any? In stating the dilemmas, make explicit the competing moral reasons involved. Are there any ideas or concepts involved in dealing with the moral issues that should be clarified? What factual...
##### what are problems of having My Health Record who is effected by My health record  and its...
what are problems of having My Health Record who is effected by My health record  and its impact with evidence and give a solution. and statement of position of My Health Record.
##### A dog barks outside my window as I sleep, but I do not wake up. My...
A dog barks outside my window as I sleep, but I do not wake up. My wife then whispers my name and I wake up with a start. Why does this happen?
##### When a company that makes up a cartel breaks one of the rules, punishment strategies are...
When a company that makes up a cartel breaks one of the rules, punishment strategies are developed, what are these strategies?
##### I'm having a very hard time getting this c++ code to work. I have attached my...
I'm having a very hard time getting this c++ code to work. I have attached my code and the instructions. CODE: #include using namespace std; void printWelcome(string movieName, string rating, int startHour, int startMinute, char ampm); //menu function //constants const double TICKET_PRICE = 9.95; const double TAX_RATE = 0.095; const bool AVAILABLE = true; const bool UNAVAILABLE = false; int subTotal,taxAdded, totalCost; // bool checkAvailability( int tickets, int& seatingLeft){ //checks ticket availability while(tickets > 0 || tickets <= 200) //valid...