c=int(raw_input("How many numbers do you want to work? (Min. 2 Max. 3)"))
if c==2:
x=int(raw_input("Enter the first number to be worked"))
y=int(raw_input("Enter the second number to be worked"))
elif c==3:
x=int(raw_input("Enter the first number to be worked"))
y=int(raw_input("Enter the second number to be worked"))
z=int(raw_input("Enter the third number to be worked"))
else:
print "Invalid input.";raw_input("Press to close this window");exit
p=int(raw_input("Do you want to divide, subtract, add or multiply these
numbers? (1=divide, 2=subtract, 3=add, 4=multiply)"))
if p==1 and c==2:
print "The result is : ";x/y
elif p==1 and c==3:
print "The result is :";x/y/z
elif p==2 and c==2:
print "The result is :";x-y
elif p==2 and c==3:
print "The result is :";x-y-z
elif p==3 and c==2:
print "The result is :";x+y
elif p==3 and c==3:
print "The result is :";x+y+z
elif p==4 and c==2:
print "The result is :";x*y
elif p==4 and c==3:
print "The result is :";x*y*z
else:
print "Invalid Input.";raw_input("Press to close this window")
That is my program. These are the problems I am having :
1. Even if c is not 2 or 3, the program continues, as if it received a valid
input, it does not exit as I have tried to code it to.
2. If all values are entered correctly, the result does not display. It shows
up as "The result is :" and just blank.
PLEASE HELP
--
https://mail.python.org/mailman/listinfo/python-list