At 06:55 PM 7/30/2005, Nathan Pinno wrote:
...
elif cal_opt == 4:
X = input(First
number: )
Y = input(Second
number: )
if Y == 0:
print
Division by zero ot allowed!
Y =
input(Second number: )
else:
print
X, /, Y, = ,X / Y
Note that you give user a 2nd try but that input never reaches the
When I run the following code it just keeps repeating. Here is a screen
shot showing what I mean:
Mini CalculatorBy Nathan Pinno
CALCULATE MENU1) Add2) Subraction3) Multiplication4)
Division w/o remainder5) Division with remaider6) Exponation7)
Square roots9) ExitOption: 5First
Looks like you are making some pretty good progress.
The short answer to your question is that the menu user input need to be
inside the while loop. That way cal_opt has a chance to change value before
it gets evaluated by the while loop again.
Another comment - the global cal_opt is
Thanks Todd. Can you please look at my other messages that you haven't
answered, and see what's wrong with them, or what the answer is.
- Original Message -
From: [EMAIL PROTECTED]
To: tutor@python.org
Sent: Saturday, July 30, 2005 8:10 PM
Subject: Re: [Tutor] When I run this code