Hello Daniweb,
I'm beginning to learn Python, which I hope shall be a useful tool to help with server administration and the such.
I am however having some problems, I'm sure this is a very simple problem but I can't see what is going wrong.
#!/usr/bin/env python3.3
validSelection = 0
print("Welcome to the Python Calculator V1.0 \n")
print("Please choose what operator you would like to use: \n")
print("1. Addition")
print("2. Division")
print("3. Subtraction")
print("4. Multiplication \n")
while(validSelection != 1):
menuSelection = input("Please Make Your Selection: ")
if(menuSelection == 1):
validSelection = 1
Val1 = input("Please Enter Value 1: ")
Val2 = input("Please Enter Value 2: ")
Addition(Val1, Val2)
elif(menuSelection == 2):
validSelection = 1
Val1 = input("Please Enter Value 1: ")
Val2 = input("Please Enter Value 2: ")
Division(Val1, Val2)
elif(menuSelection == 3):
validSelection = 1
Val1 = input("Please Enter Value 1: ")
Val2 = input("Please Enter Value 2: ")
Subtraction(Val1, Val2)
elif(menuSelection == 4):
validSelection = 1
Val1 = input("Please Enter Value 1: ")
Val2 = input("Please Enter Value 2: ")
Multiplication(Val1, Val2)
else:
print("\nThat Selection is Not Valid! \n")
This is only part of the calculator, but it always displays as an invalid selection. If I type in 1, 2, 3 or 4 (which should be valid) it shall always shoot to the else part of my if statement.
Any help would be greatly appreciated.
Thank you!