Regarding PyCALC:
def calc():
while True:
print ("Welcome to PyCALC")
print ("Please type the number for your suggestion.")
print ("1: Addition\n2: Subtraction\n3: Multiplacation\n4: Division")
suggestion = input("Your Choice: ")
if suggestion == "1":
num1 = int(input("Enter a number: "))
num2 = int(input("Enter a number: "))
print ("Please wait...")
time.sleep(0.6)
answer = num1+num2
print ("Your answer is:")
print (answer)
break
if suggestion == "2":
num1 = int(input("Enter a number: "))
num2 = int(input("Enter a number: "))
print ("Please wait...")
time.sleep(0.6)
answer = num1-num2
print ("Your answer is:")
print (answer)
break
if suggestion == "3":
num1 = int(input("Enter a number: "))
num2 = int(input("Enter a number: "))
print ("Please wait...")
time.sleep(0.6)
answer = num1*num2
print ("Your answer is:")
print (answer)
break
if suggestion == "4":
num1 = int(input("Enter a number: "))
num2 = int(input("Enter a number: "))
print ("Please wait...")
time.sleep(0.6)
answer = num1/num2
print ("Your answer is:")
print (answer)
break
else:
print ("Your operation choice is invalid!")
Using numbers to encode user input isn't necessarily bad, but your code shouldn't have those repeated throughout it. Consider instead using an Enum, which ships with Python 3, and is pip install-able in Python >=2.4; http://stackoverflow.com/a/1695250/2581168.
The conditions under which this function is exited aren't clear. Consider using an explicit valid_input parameter, initialised to False, which is set to True when the user inputs something valid.
If the user inputs something valid, all four outcomes are almost completely identical. Consider putting them all into another function, where only that one line is branched.
from enum import IntEnum # run 'pip install enum' first if you're not on Python 3!
class Operation(IntEnum):
add = 0
sub = 1
mul = 2
div = 3
def perform_calculation(op):
num1 = int(input("Enter a number: "))
num2 = int(input("Enter a number: "))
print ("Please wait...")
time.sleep(0.6)
if op == Choice.add:
answer = num1+num2
elif op == Choice.sub:
answer = num1-num2
elif op == Choice.mul:
answer = num1*num2
elif op == Choice.div:
answer = num1/num2
print ("Your answer is:")
print (answer)
break
def calc():
valid_choice = False
while not valid_choice:
print ("Welcome to PyCALC")
print ("Please type the number for your suggestion.")
print ("{0}: Addition\n{1}: Subtraction\n{2}: Multiplacation\n{3}: Division".format(int(Choice.add), int(Choice.sub), int(Choice.mul), int(Choice.div)))
input_op = int(input("Your Choice: "))
if input_op in Operation.__members__.values():
perform_calculation(input_op)
valid_choice = True
else:
print ("Your operation choice is invalid!")
It's possibly a bit out of scope, but if you wanted to win brownie points from functional programmers, take a look at the Operator library and see if you can find an even cleaner way of doing this; https://docs.python.org/2/library/operator.html.